Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to set base url for tinymce-vue #34

Closed
zmqcherish opened this issue Oct 19, 2018 · 7 comments
Closed

how to set base url for tinymce-vue #34

zmqcherish opened this issue Oct 19, 2018 · 7 comments

Comments

@zmqcherish
Copy link

zmqcherish commented Oct 19, 2018

I use tinymce-vue component Editor like below:
<editor v-model="article.content" api-key="***" :init="editorConfig"></editor>
and it auto download tinymce.min.js from https://cloud.tinymce.com/stable/tinymce.min.js.
But sometime it may download fail.(In China, you know...).
So, how to set my own base url to download the script and other related js file.

I try to add the baseURI in my editorConfig, but it can not work:
editorConfig: { baseURI: 'https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.8.3/', height: 330, plugins: "image link", // some other settings }

on the mounted set also can not work:
window.tinymce.baseURL = 'https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.8.3/';

@fyrkant
Copy link
Contributor

fyrkant commented Oct 19, 2018

There's no baseURI setting that can change which tinymce is loaded, the easiest way to do what you want to do would be to add a script tag linking in the CDN you want to use before you load the editor vue application.

@zmqcherish
Copy link
Author

zmqcherish commented Oct 19, 2018

@fyrkant I find there are properties called baseURI and baseURL in official docs: https://www.tiny.cloud/docs/api/tinymce/tinymce.editormanager/#properties,
but I don't how to use them.
In addition, I can't add a script tag for my vue component, just want to use the Editor component like below:
import Editor from '@tinymce/tinymce-vue';

@fyrkant
Copy link
Contributor

fyrkant commented Oct 19, 2018

Those are properties on the editor object, not settings - so stuff you can read but not set.

Is there a reason why you can't add a script tag? You have to add a script tag already for the vue app, right?

Other than a script tag you can try to bundle the editor into your javascript bundle, but that is a bit more work to get working, you have to host the skin files and so on.

@zmqcherish
Copy link
Author

@fyrkant thanks, I just make it work.
But I still want there is a trick to change the default script download url, when use the component Editor. Otherwise some vue feature can not be used, like v-model

@fyrkant
Copy link
Contributor

fyrkant commented Oct 19, 2018

You can still use v-model even if you load tinymce with a script tag, if you just load TinyMCE with a script tag before you load your vue application the tinymce-vue component will use the tinymce you have made available with the script tag instead of auto-loading from the TinyMCE Cloud.

@zmqcherish
Copy link
Author

@fyrkant thank you very much.

@haust-lyb
Copy link

@fyrkant thank you very much.

现在是2021年了,哥们,我也遇到了和你一样的问题,我需要在局域网中使用tinymce,请问您解决了这个cdn加载问题了吗?我还使用了一些插件好像也是从外网加载的.@zmqcherish

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants