zoukankan      html  css  js  c++  java
  • TinyMCE添加图片 路径自动处理成相对路径

    默认情况下会自动转换你的图片路径如:

    转换:

    /path/name.jpg

    ../path/name.jpg

    带有域名的路径也会被转换为相对路径。

    需要修改一个设置convert_urls,官方文档:

    https://www.tinymce.com/docs/configure/url-handling/#convert_urls

    This option enables you to control whether TinyMCE is to be clever and restore URLs to their original values. URLs are automatically converted (messed up) by default because the browser's built-in logic works this way. There is no way to get the real URL unless you store it away. If you set this option to false it will try to keep these URLs intact. This option is set to true by default, which means URLs will be forced to be either absolute or relative depending on the state of relative_urls.

    翻译:

    这个选项使您能够控制TinyMCE是否聪明的url和恢复到原来的值。默认url自动转换(混乱),因为浏览器内置的逻辑处理。没有办法真正的URL,除非你存起来了。如果您设置这个选项错误会尽量保持这些url完好无损。这个选项是默认设置为true,这意味着url将被迫是绝对或相对取决于relative_urls的状态。

    因此在初始化时候,多添加一个参数:

    tinymce.init({
      selector: 'textarea',  // change this value according to your HTML
      convert_urls: false //这个参数加上去就可以了
    });

    TinyMCE的中文教程不多,想搜索一些解决办法,都很难找到。就算有也是针对于老版本的。PS.自己整合了一下前人弄的上传图片的插件,总算搞定了。by OSFIPIN

  • 相关阅读:
    算法之【仿竖式算法】
    算法之【大整数乘法】
    EIGRP系统复习【转载】
    算法之【插入排序法】
    算法之【折半插入法】
    ★10 个实用技巧,让Finder带你飞~
    ★宣传广告变成社会标准
    ★路由递归查询方法及相关图…
    自制tunnel口建虚拟专网实验
    【★】路由环路大总结!
  • 原文地址:https://www.cnblogs.com/osfipin/p/5763883.html
Copyright © 2011-2022 走看看