I have a Summernote editor in an ng-dialog and I'm trying to make all links that are inserted open in a new tab by default. I added a CSS class to the editor to hide the checkbox for that option but I can't figure out a way to check that checkbox.
Is there an insertLink or dialogOpen event that I can place my code for checking the checkbox? Thank you!
Go to the summernote.js file and find
$openInNewWindow.prop('checked', linkInfo.isNewWindow);
Set this forcefully true by replacing linkInfo.isNewWindow
$openInNewWindow.prop('checked', true);
Hopefully it will resolve your issue.
Related
I use TinyMCE for content editing. I allow people to enter links in their HTML. So when the user clicks on add link, he sees the following popup:
But none of the users is actually using any of the fields except of URL. Is there a way to remove all these fields and leave only URL, but when the user click on the link in created html - to open this link in the new tab/window?
I tried to look at their documentation, but was not able to find how to achieve this.
Well, you can clone the tinymce core plugin rename it and remove the parts you don't need.
Don't forget to include the new name in your tinymce plugin and button config.
I'm running into an issue where I have a button on my page that has a CKEditor.
When the button is pressed I want to append text to the editor.
I used the following code:
$('#mtxDescription').append($(this).data('key'));
CKEDITOR.instances['mtxDescription'].updateElement();
However this does not work. The editor does not reflect the change. However when I inspect the editor I find that the textarea does show the appropriate text appended, its just the editor is not showing it. Does anyone know of a way to get around this. Also, just in case anyone is wondering, I do have the jquery CKEditor adaptor script referenced in my page.
Also, if a somewhat related, but separate issue.
I have a drop down list that will allow the user to toggle between the text area shown on the page being the CKEDitor WIZIWIG and going back to being a normal textarea again. However I can't seem to do this without literally refreshing the page, I want to do it through javascript/jquery so I don't have to refresh the page whenever the change the dropdown selection. I've already tried the built in destroy method. It doesn't seem to do anything visually, the editor does not revert back to a simple textarea.
Just in case you were going to ask for some more code, here is what my HTML page looks like:
<textarea id="mtxDescription" name="mtxDescription"></textarea>
Here is how I initialize the editor
CKEDITOR.replace('mtxDescription', {
sharedSpaces: { top: 'ed-top'}
});
I was able to solve this problem by using the following code instead of using jQuery CKEDITOR.instances.mtxDescription.insertHtml($(this).data('key')) I still need a way to remove the editor at runtime.
I need to hide and show the editor based on event.
I initiate the editor. then, i try to hide using the code:
$('#textare').hide();
but it doesn't work, since it as I think initiate iframe
so how can I show and hide editor
Update: I'm sorry forget to add editor name.. I use wysihtml5.
I think the way that editor work is hide the textarea and make iframe
so the above text couldent hide the editor.
The textarea should already be hidden since it will only be used as a fallback. The editor itself is contained in an iframe with class wysihtml5-sandbox. So this should toggle the editor
$(".wysihtml5-sandbox").hide()
I want to prevent TinyMCE disabling gecko spellcheck. I've added gecko_spellcheck : true to config. It works fine, but when I type a new paragraph all highlights of previous paragraph are gone. Some illustrations:
When I make right click on textarea and disable/enable spellchecking, all of errors are highlighted. How can I make TinyMCE always to highlight errors?
This is a problem that can be resolved.
If you reset the tinymce iframe body everything that is spelled incorrectly gets underlined.
You may use this ed.getBody.innerHTML = ed.getBody.innerHTML; to make it work.
if I have more than one tinymce editor on a page, every action I do goes to the last editor unless I explicitly click on the editor I want to edit. For example, I made a plugin, which displays a dialog box, I type something in the dialog box and it should go to the first editor (I launch the dialog box from the first editor) but it goes to the last one, as it is the currently active editor.
How do I make the first editor active, once the page is loaded?
try this
tinyMCE.execInstanceCommand("mce_editor_0", "mceFocus");
taken from here
If you have multiple tinyMCE forms on one page, I recommend
Command: runScript
Target: tinyMCE.get('textarea_id').setContent('Your Text')