How to change activeEditor in TinyMCE? - tinymce

How can I change activeEditor programetically in tinyMCE.
Ex:
Like if I have two editors in same page, How can I switch between them programetically?

The activeEditor will switch when you focus a different editor so the method is to call focus on the editor you want to be active. You can choose to not actually focus the editor by passing false.
https://www.tiny.cloud/docs/api/tinymce/tinymce.editor/#focus
Extract from that page:
focus
focus(skipFocus:Boolean)
Focuses/activates the editor. This will set this editor as the
activeEditor in the tinymce collection it will also place DOM focus
inside the editor.
Parameters
skipFocus (Boolean) - Skip DOM focus. Just set is as the active editor.

We can get any instance of TinyMCE by tinyMCE.get('field-name') or by tinyMCE['field-name'] here field name will be the field TinyMCE is associated with.

Related

How to cancel focus() of Grav build-in CodeMirror editor

I would like to add my custom WYSIWYG-editor with my plugin over Grav build-in editor without removing the last.
I append my editor as a divider with contenteditable="true" to .CodeMirror-lines > div as the container where is also build-in .CodeMirror-code editor divider. And my editor is above as layer (z-index is higher).
But when I click the area, the build-in editor is focused and not mine.
I've viewed the codes of both user/plugins/admin/themes/grav/js/admin.min.js and user/plugins/admin/themes/grav/js/vendor.min.js to find the row(s) which is(are) responsible for such focusing, but I can't.
Could someone help to cancel this focusing?
Ok, to resolve the problem it's enough to append my editor not to .CodeMirror-lines > div, but to .grav-editor-content divider

CodeSandbox editor has stopped auto completing the corresponding JSX closing tags?

CodeSandbox editor used to auto generate the corresponding close tag for the current tag.
For example:
<div> // THEN IT WOULD AUTO GENERATE THE </div> TAG
But don't know exactly when, it stopped doing that, and I have to write it manually. Is there a way to enable this autocomplete again?
In the codesandbox.io go to:
File -> Preferences -> Settings
In the Search Settings box type Javascript Autoclosing Tags.
Enable that feature by checking the Checkbox.
Just posting an updated answer since the UI has changed for codesandbox. I believe this answer is now slightly better:
Press cmd+, (ctrl+, on a windows) with the editor focused (this opens the vscode settings)
You should see a settings page like so:
In the Search Settings box type Javascript Autoclosing Tags
Toggle the checkbox on
In my case the auto completion works if a change the extension of the file to .jsx and if I start typing the tag without the <.

Is there a shortcut for color chooser in NetBeans?

Is there a shortcut for color chooser in NetBeans?
I found this same query on NetBeans website, it was said that this was possible but I can't find an actual answer how to do it.
I mean this: when I am in a CSS file and I am editing a property that involves a color, the color chooser pops up automatically. I would like to have the color chooser pop up on demand when I am editing any file (e.g. a PHP file). It would be very helpful.
I already looked in Options -> Keymap and there seems to be no shortcut containing the word "color".
Thanks.
In the editor, click the text representing the color (you don't even have to highlight the whole thing), then hit Ctrl+Spacebar.
While it's not ideal in Netbeans 8.0.2 you can do the following:
open any CSS file that contains a rule with a property that takes colour as value and place the cursor inside the declaration block of that rule,
in the top menu click on Window -> Web -> CSS Styles,
click on the dropdown with colour values and scroll right to the top,
click on Choose Color and a colour chooser will appear.
You can now close the CSS file (if you like) and open any type of file - the CSS Styles window will stay and you can repeat the above procedure starting from step 3.
P.S. Netbeans has a bug tracker that is not just for reporting bugs:
Issues = Bugs, Feature Requests, and Enhancements

Create jdt look like custom tool tip for GEF canvas objects

I have a graphical representation for my model, and I want to implement a tooltip that look like jdt tooltip in the following :
- the tooltip shows up when hover over the object in the canvas
- being able to click on the tooltip window to focus, and scroll bar is there if needed.
- Ability to resize the tooltip window after the user change focus to it
- being able to assign command with F2 keybind to pop up the tooltip window (I know how to create command, and how to associate keybind with it)
- Ability to have hyperlinks in the tooltip text ( optional )
I do not know from where to start.
Which eclipse interfaces/classes to implement, extensions to add, adaptors to support.
I tried to find a work through tutorial but I could not.
Thanks in advance
A lot of what you describe is specific to the Eclipse Text editor and JDT code so won't be available in a Canvas so you would have to write your own code.
You can create a tooltip based on org.eclipse.jface.window.ToolTip. If the tooltip contains StyledText you can create hyperlinks.
There is an example of a fairly elaborate custom tooltip Here
What Eclipse does when the tooltip is clicked is open a new normal window of exactly the same size and contents over the tooltip and close the tooltip.

JQueryUI Dialog TinyMCE Issues

i am having some problems with the TinyMCE (V3.4.7) and JqueryUI (V1.8.14) Dialog
the following Fiddler link shows my example purfectly here
What i am trying to do is open a JqueryUI Dialog box with a TinyMCE WYSIWYG Editor in it.
the first time it displays properly. but if you click close and then reopen the box it will not show the Editor but just the TextArea.
Any help would be good. Thanks
Update
I did find out a solution that works for me, i have put up the working code here
What i am doing is check to see if the dialog has been opened before and if so just open it, then in the Open Function i test to see if the box contains an element with id_parent
if it does then this will be the editor (so do nothing) otherwise just init as usual.
it seems there is a problem with the JQuery Plug in as it does not remove the elements when you call tinyMCE.execCommand('mceRemoveControl',false,'editor_id') and when you re-add the editor it attaches to the first box available.
Problem here is that you need to shut down tinymce correctly in order to open an editor with the same id.
Use:
ed.execCommand('mceRemoveControl', false, 'editor_id');// editor_id equals the id of your textarea