Imperavi Redactor - Caret always on the start - plugins

my question is kinda similar to one asked here
So, I have made several Redactor plugins, which generate html content from specific APIs (for example: Plugin that gets comments from API). Plugin than inserts HTML data into Redactor. However when HTML is inserted, caret (cursor) dissapears. That not something that I want, because if I want to add another plugin data, I' ll get this error:
Uncaught DOMException: Failed to execute 'setStartAfter' on 'Range': the given Node has no parent.
the only way that I can avoid this problem is by clicking underneath inserted data. How can I fix this?
P.S. I use Mustache, for simplified html insertion.

Related

Form displaying an error in frontend TYPO3

I have followed every tutorial on Form. In every tutorial after I finish their steps the form appears in front-end. My form displays this error:
Oops, an error occurred! Code: 20220818062042eaedc27c
I have installed a sitepackage in my page and created some custom masked element but nothing I think to interfere with the Form module. What could be causing this?
Since I am new to TYPO3 I have made a noob mistake. Anyway I am leaving the answer here for anyone to see. Also this does not apply only to this case, just be careful to not forget to include this for other extensions as well:
This should work after that, if not just give a flush cache and you should be good.

web submission automation: simulate onclick event on a title element to load form

A resume-service I use requires that for each listed activity on the resume, there is an hours-per-week field and total hours field. However, the total hours field does not update itself automatically no matter how many weeks pass. My goal is to write a script that does this.
The idea behind the script is:
Log in to website -> go to a certain page -> submit a form** on that page updating the total hours
**unfortunately, for the form to open, you need to click an "edit" title element first which causes it to show up. I've taken a look at the html of the webpage but cannot find the form or input tags corresponding to the form I wish to submit, only that the form is generated with what I think is a javascript function call from the element's onclick field.
I believe the relevant html snippet is:
<a title="edit" class="edit" href="#entry-type" onclick="editComponent('10227041','education');">Edit</a>
but just in case there is a much larger code snippet later in this post (check the 2nd pastebin link at the bottom)
THE QUESTION: Is there a specific language/library/way (preferably in python, although I can work with Java) to simulate an onclick event and that would result in a form loading?
I've worked on this problem a bit, starting with python's mechanize library. I wrote two functions,
def login(br,url):...
def navigate(br,baseurl,url):...
which would satisfy the first two parts of my script's plan, but the third is where the trouble starts. When I print all the forms on the page using
for form in br.forms():
print form
I get http://pastebin.com/Gxy2tc1A
The website's html can be found on http://pastebin.com/PySri5cb
Later I tried to work with Selenium (the firefox IDE plugin) and then exporting code into python, where I would edit it to satisfy my specific needs, but that was a no-go either due to some awkward errors.
Have you looked into GreaseMonkey? You should be able to use that to extract the hours per week, do the math and populate the total hours field. You could probably do the entire thing. Anything that can be done on the page in JavaScript could be done within GreaseMonkey.
EDIT: The code for that site is awful. I especially like the inline call to loadResume() that is made BEFORE the element it writes to (#build-wrap).

No rights on page-module level

I encounter a strange error. On page-module level i´m not allowed to create new page elements. If i do the same via the list-module page-elements are created and i can edit them (even in the page-module).
Also, if i created a flexible content element - e.g. columns - (via the list module) i CAN create new elements in the flexible content element, even in page module.
New elements are always on TOP of the page, meaning the first entry, and i can´t drag and drop them. Well, i can, but changes do not come in effect. To sort the elements I have to edit the page properties, and sort content.
The user has every right(!) given by the user settings, and it is TYPO3 4.7.4
Does anyone know where i have to look for a solution? Thanks in advance!
Edit 1
This error appears in the log:
Attempt to insert record on page '[root-level]' (0) where this table, tt_content, is not allowed (msg#1.1.11)
Again: Creating Elements IS working via the List-Module.
This error is causen because the field t3ver_swapmode in the page table was removed since TYPO3 4.7 (Maybe in combination with TemplaVoila).
I dont know whats exactly going on here (didnt had the time to find that out), but the solution is of cource simple. I uploaded my fix to the TYPO repository under the key swapmodefix http://typo3.org/extensions/repository/view/swapmodefix
The extension appears in a couple of hours, good luck!
You need to select a page inside the pagetree first. You may not create content elements on the root page.
It might be that the selection is lost, but still visibel. Just click the page again.

tiny mce not working properly in google chrome

I have four textareas in my form. TinyMce editor applies to only first row of the textarea, remaining rows for textareas dont get editor in google chrome. It works fine in firefox instead.
It's hard to know without seeing the code, but I'm going to go ahead guess that you are referencing your multiple textareas using the same ID. IDs must be unique - so give them each their own individual ID and then attach the editor with four separate calls, or reference them by class instead.
Or attach some code for us to take a look at.

Hyperlinking the eclipse console - delayed writes causing BadLocationException?

I'm writing an eclipse plugin with a hyperlinked console, but I see BadLocationExceptions when creating the hyperlinks.
To create the hyperlink, I followed the instructions on the related question How to write a hyperlink to an eclipse console from a plugin.
Background: The issue appears to be that the underlying document is updated asynchronously to requests that write to the console (e.g. via a MessageOutputStream), so attempting to create a hyperlink immediately after a write won't work because the offset and length indices provided in the request are invalid.
To try to fix this, I created a DocumentListener on the underlying document, so I could detect when the console is updated and create the HyperLink at that point. But the listener is provided with events that correspond to bulk updates to the console - so I can't easily detect if the console has been updated yet. The only choice seems to be to search the console document for the string I want to hyperlink, which seems quite inefficient.
So the question is: when is the correct time to create a HyperLink, after writing to the console? Are there any proven mechanisms that guarantee the underlying document will have been updated when I issue my hyperlink creation request? An example of code that writes to the console then creates a HyperLink would be great.
Not sure of the exact version of eclipse (I'm writing this from home before heading into work) - but I do know that I'm using MessageConsole.addHyperlink() to issue the request.
I am in exactly the same situation, and came to the same conclusion: I add the hyperlink in a document listener, then remove the document listener. Note that you have no other option than searching for the string, because the console can be cleared by the user! In my case, it is not a severe performance penalty, so I'm happy with this solution.