返回介绍

URL conversion example

发布于 2019-05-06 06:50:17 字数 5174 浏览 1165 评论 0 收藏 0

This example shows you how to setup TinyMCE to produce different results for its URLs in images and links. You can read more about these config options in the TinyMCE FAQ.

Absolute URLs on links and images

<textarea id="url-conversion-absolute-1" name="absurls" cols="85" rows="10"><p>Some relative urls: <a href="example_08.php">content</a>. <img src="//www.tiny.cloud/images/glyph-tinymce@2x.png" alt="TinyMCE Logo" width="10%" /></p>
  <p>Some absolute urls: <a href="https://archive.tinymce.com/examples/example_08.php">content</a>. <img src="//www.tiny.cloud/images/glyph-tinymce@2x.png" alt="TinyMCE Logo" width="10%" /></p>
</textarea>
tinymce.init({
  selector: '#url-conversion-absolute-1',
  height: 230,
  plugins: 'link image code',
  relative_urls: false,
  content_css: [
    '//fonts.googleapis.com/css?family=Lato:300,300i,400,400i',
    '//www.tiny.cloud/css/codepen.min.css'
  ]
});

Absolute URLs and including domain on links and images

<textarea id="url-conversion-absolute-2" name="absurls" cols="85" rows="10">
  <p>Some relative urls: <a href="example_08.php">content</a>. <img src="//www.tiny.cloud/images/glyph-tinymce@2x.png" alt="TinyMCE Logo" width="10%" /></p>
  <p>Some absolute urls: <a href="https://archive.tinymce.com/examples/example_08.php">content</a>. <img src="//www.tiny.cloud/images/glyph-tinymce@2x.png" alt="TinyMCE Logo" width="10%" /></p>
</textarea>
tinymce.init({
  selector: '#url-conversion-absolute-2',
  height: 230,
  plugins: 'link image code',
  relative_urls: false,
  remove_script_host: false,
  content_css: [
    '//fonts.googleapis.com/css?family=Lato:300,300i,400,400i',
    '//www.tiny.cloud/css/codepen.min.css'
  ]
});

Relative URLs on links and images

<textarea id="url-conversion-relative-1">
  <p>Some relative urls: <a href="example_08.php">content</a>. <img src="//www.tiny.cloud/images/glyph-tinymce@2x.png" alt="TinyMCE Logo" width="10%" /></p>
  <p>Some absolute urls: <a href="https://archive.tinymce.com/examples/example_08.php">content</a>. <img src="//www.tiny.cloud/images/glyph-tinymce@2x.png" alt="TinyMCE Logo" width="10%" /></p>
</textarea>
tinymce.init({
  selector: '#url-conversion-relative-1',
  height: 230,
  plugins: 'link image code',
  relative_urls: true,
  content_css: [
    '//fonts.googleapis.com/css?family=Lato:300,300i,400,400i',
    '//www.tiny.cloud/css/codepen.min.css'
  ]
});

Relative URLs on links and images to a specific page

<textarea id="url-conversion-relative-2">
  <p>Some relative urls: <a href="example_08.php">content</a>. <img src="//www.tiny.cloud/images/glyph-tinymce@2x.png" alt="TinyMCE Logo" width="10%" /></p>
  <p>Some absolute urls: <a href="https://archive.tinymce.com/examples/example_08.php">content</a>. <img src="//www.tiny.cloud/images/glyph-tinymce@2x.png" alt="TinyMCE Logo" width="10%" /></p>
</textarea>
tinymce.init({
  selector: '#url-conversion-relative-2',
  height: 230,
  plugins: 'link image code',
  relative_urls: true,
  document_base_url: '//www.tiny.cloud/demo/',
  content_css: [
    '//fonts.googleapis.com/css?family=Lato:300,300i,400,400i',
    '//www.tiny.cloud/css/codepen.min.css'
  ]
});

No URL conversion

<textarea id="url-conversion-none">
  <p>Some relative urls: <a href="https://www.tiny.cloud/docs/demo">content</a>. <img src="//www.tiny.cloud/images/glyph-tinymce@2x.png" alt="TinyMCE Logo" width="10%" /></p>
  <p>Some absolute urls: <a href="https://www.tiny.cloud/docs/demo">content</a>. <img src="//www.tiny.cloud/images/glyph-tinymce@2x.png" alt="TinyMCE Logo" width="10%" /></p>
</textarea>
tinymce.init({
  selector: '#url-conversion-none',
  height: 230,
  plugins: 'link image code',
  convert_urls: false,
  content_css: [
    '//fonts.googleapis.com/css?family=Lato:300,300i,400,400i',
    '//www.tiny.cloud/css/codepen.min.css'
  ]
});

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文