Closed peterw8102 closed 5 years ago
Stripping out the crud the current path can be reduced to:
var currentPath = (document.currentScript ?
document.currentScript.src :
Array.prototype.slice.call(document.getElementsByTagName('script')).pop().src
) .replace(/[^\/]+$/,'');
Still don't particularly like this. Other suggestions?
I want to push a branch to this repo with suggested changed but don't have permission :(
@peterw8102 please check this issue on gitlab.. still open ;).. sorry, just moved the repo... https://gitlab.com/tinymce-plugins/tinymce-codemirror/issues/33
but as you wrote earlier (https://github.com/christiaan/tinymce-codemirror/issues/33#issuecomment-318521866), you can make a MR and we/i will check
Thanks @thomich - I realised after I'd left the other comment so deleted it. I'll start using the new repo and when I get a moment I'll look into this again. It's been quite a while now so I need to refresh my memory.
I'm trying to keep non-Tinymce plugins outside of the Tinymce tree to make upgrades easier.
This plugin works fine when within js/tinymce/plugins/codemirror directory. However the following fails:
The problem is the plugin tries to load 'source.html' from the path provided by TinyMCE as a parameter to tinymce.PluginManager.add()
'url' here will be /tinymce/js/plugins - not where the plugin actually resides.
I've fixed this by working out the path of the currently executing script then using that as the base path for source.html.
I really don't like this as a solution and will look for something better. It should be possible though to have the plugin outside of the TinyMCE source tree.