Using the advlink plugin, the default value for "target" is "_self" (i.e. links open in same window/tab). How can I make it so that links open in a new window/tab by default?
tinymce 3.x advlink plugin - set links to open in new window/tab by default
813 views Asked by pazof At
1
There are 1 answers
Related Questions in TINYMCE
- How to re-select the same text after modifying it in TinyMCE React
- where the images uploaded in tinymce are stored?
- First whitespace doesn't trigger the onEditorChange function in react JS TinyMCE version 6.8.2
- TinyMCE custom toolbar button to set CSS property of selected text
- Any suggestion to replace deprecated tinymce.create() api?
- TinyMCE removes assigned id='name' attribute of input
- Troubleshooting TinyMCE data retention issue
- How to initialize TinyMCE with Javascript ? [ACF]
- How to add custom color toolbar button in tinymce editor
- ToggleToolbarDrawer persist visible even when I close or switch tab and closing of bootstrap modal
- How do I get all the nodes from a TinyMCE selection
- inline tinymce editor does not trigger input event
- TinyMCE: How to enable self-closing tags? (custom tags)
- Calculating width and height attributes with the image plugin (tinymce)
- PIMCORE: How to globally configure TinyMCE (WYSIWYG) for data object? (Version 11.1.4)
Related Questions in TINYMCE-PLUGINS
- Any suggestion to replace deprecated tinymce.create() api?
- How to add custom color toolbar button in tinymce editor
- Calculating width and height attributes with the image plugin (tinymce)
- Is there a way of adding tinymce plugin in this gem refinerycms-tinymce?
- How to autosave in TinyMCE For Flow?
- How to change the style/skin of the TinyMCE pop up window?
- TinyMce Code plugin - Font Awesome / List
- prevent TinyMCE 5 from removing empty lines before custom paste_preprocess function
- TINYMCE configuration to get structured input
- @tinymce/tinymce-angular@^3.0.0 <editor> is not loading second time visiting the page in Angular 8
- How to use the TinyMCE Preview plugin securely?
- TinyMCE custom dialog input size
- How to add H5P to Code Igniter or TinyMCE Editor?
- tinyMCE XSS vulnerability and angular-ui-tinymce
- ICONS are not showing up In the toolbar section TinyMCE Django
Related Questions in TINYMCE-3
- How disable color from paste
- tinyMCE5 is adding p tags automatically only on firefox
- How to set default Font and Font Size in Tinymce3.0?
- TinyMCE -> AjaxFileManager "Syntaxerror: unexpected token <"
- How do I remove and add a tinyMCE editor from the page and add it again with the same ID, more than once?
- How to set width from tinyMCE in Wicket
- TinyMCE paragraph element unfocusable in Internet Explorer 11
- How to keep the text format same from in textarea
- Counter for TinyMCE is not working as expected
- Character Limit is showing remaining characters in "negative" numbers
- TinyMCE Paste from word not working properly
- Replace specific dom element with new content
- tinymce 3.x advlink plugin - set links to open in new window/tab by default
- How to add custom shortcuts in tinyMCE 3.5
- Tiny Mce Two way Binding with Angular 2/4
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
We need to make the following changes in the file
advlink.jslocated in[yourTinymcePluginsDirectory]/advlink/js/advlink.js.Locate the following part:
We need to change the order of the options. So just put the "_blank" option on top:
And voila, that was it. Was it? No!
Although this will indeed work, if we try changing the target of a link back to
_self, although the HTML will indeed be updated correctly, the dropdown will falsely show the_blankoption as selected. This happens because when selecting the_selfoption thetargetTinymce attribute is not updated to_selfbut rather to "" - so an empty string. Therefore, when selecting_selfthe script will try to look for an attribute named "", will of course find none, therefore it will select the first option by default. While this works when the first option is_self, it will not work when_selfis not the first option.To solve this problem, we need to tell the script that when the target Tinymce attribute is set to an empty string, it should look for the attribute named
_selfinstead. That way it will be able to locate it even if it's not the first option.To achieve this we also need to make one more change to the script's behavior. Locate the following line:
And replace it with:
And now everything should work perfectly, with
_blankbeing the default target option.