1
0
mirror of https://github.com/tabler/tabler.git synced 2025-12-21 17:34:25 +04:00

Refactor: Replace TinyMCE with HugeRTE and update related documentation

This commit is contained in:
codecalm
2025-05-11 13:30:43 +02:00
parent bb617b8dd2
commit 0e935316f5
6 changed files with 31 additions and 90 deletions

View File

@@ -2,7 +2,6 @@
Markdown Markdown
*/ */
.markdown { .markdown {
font-size: $font-size-200;
line-height: $line-height-xl; line-height: $line-height-xl;
> :first-child { > :first-child {

View File

@@ -1,47 +0,0 @@
---
title: TinyMCE
docs-libs: tinymce
summary: The WYSIWYG editor that is flexible, customizable, and designed with the user in mind. TinyMCE can handle any challenge, from the most simple implementation through to the most complex use case.
description: Flexible WYSIWYG editor for content.
---
[TinyMCE](https://www.tiny.cloud/docs/) documentation.
## Default text editor
Initialize TinyMCE 6 on any element (or elements) on the web page by passing an object containing a selector value to `tinymce.init()`. The selector value can be any valid CSS selector.
{% capture html -%}
<form method="post">
<textarea id="tinymce-default">Hello, <b>Tabler</b>!</textarea>
</form>
<script src="{{ cdnUrl }}/dist/libs/tinymce/tinymce.min.js" defer></script>
<script>
document.addEventListener("DOMContentLoaded", function () {
let options = {
selector: "#tinymce-default",
height: 300,
menubar: false,
statusbar: false,
plugins: [
"advlist autolink lists link image charmap print preview anchor",
"searchreplace visualblocks code fullscreen",
"insertdatetime media table paste code help wordcount",
],
toolbar:
"undo redo | formatselect | " +
"bold italic backcolor | alignleft aligncenter " +
"alignright alignjustify | bullist numlist outdent indent | " +
"removeformat",
content_style:
"body { font-family: -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue, sans-serif; font-size: 14px; -webkit-font-smoothing: antialiased; }",
};
if (localStorage.getItem("tablerTheme") === "dark") {
options.skin = "oxide-dark";
options.content_css = "dark";
}
tinyMCE.init(options);
});
</script>
{%- endcapture %}
{% include "docs/example.html" html=html %}

View File

@@ -0,0 +1,18 @@
---
title: Wysiwyg editor
docs-libs: [hugerte]
summary: The WYSIWYG editor that is flexible, customizable, and designed with the user in mind. HugeRTE can handle any challenge, from the most simple implementation through to the most complex use case.
description: Flexible WYSIWYG editor for content.
---
[HugeRTE](https://hugerte.org/) documentation.
## Default text editor
Initialize HugeRTE on any element (or elements) on the web page by passing an object containing a selector value to `hugerte.init()`. The selector value can be any valid CSS selector.
{% capture html -%}
{% include "ui/wysiwyg.html" %}
{{ script }}
{%- endcapture %}
{% include "docs/example.html" html=html %}

View File

@@ -250,9 +250,9 @@
"title": "Inline player", "title": "Inline player",
"url": "docs/inline-player.html" "url": "docs/inline-player.html"
}, },
"tinymce": { "wysiwyg": {
"title": "TinyMCE", "title": "WYSIWYG Editor",
"url": "docs/tinymce.html" "url": "docs/wysiwyg.html"
} }
} }
}, },

View File

@@ -1,36 +0,0 @@
{% assign id = include.id | default: 'mytextarea' %}
<form method="post">
<textarea id="hugerte-{{ id }}">Hello, <b>Tabler</b>!</textarea>
</form>
{% capture_script %}
<script>
document.addEventListener("DOMContentLoaded", function () {
let options = {
selector: '#hugerte-{{ id }}',
height: 300,
menubar: false,
statusbar: false,
license_key: 'gpl',
plugins: [
'advlist', 'autolink', 'lists', 'link', 'image', 'charmap', 'preview', 'anchor',
'searchreplace', 'visualblocks', 'code', 'fullscreen',
'insertdatetime', 'media', 'table', 'code', 'help', 'wordcount'
],
toolbar: 'undo redo | formatselect | ' +
'bold italic backcolor | alignleft aligncenter ' +
'alignright alignjustify | bullist numlist outdent indent | ' +
'removeformat',
content_style: 'body { font-family: -apple-system, BlinkMacSystemFont, San Francisco, Segoe UI, Roboto, Helvetica Neue, sans-serif; font-size: 14px; -webkit-font-smoothing: antialiased; }'
}
if (localStorage.getItem("tablerTheme") === 'dark') {
options.skin = 'oxide-dark';
options.content_css = 'dark';
}
hugeRTE.init(options);
})
</script>
{% endcapture_script %}

View File

@@ -1,10 +1,11 @@
{% removeemptylines %}
{% assign id = include.id | default: 'mytextarea' %} {% assign id = include.id | default: 'mytextarea' %}
<form method="post"> <form method="post">
<textarea id="hugerte-{{ id }}">Hello, <b>Tabler</b>!</textarea> <textarea id="hugerte-{{ id }}">Hello, <b>Tabler</b>!</textarea>
</form> </form>
{% capture_script %} {% capture script %}
{% removeemptylines %}
<script> <script>
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
let options = { let options = {
@@ -33,4 +34,10 @@
hugeRTE.init(options); hugeRTE.init(options);
}) })
</script> </script>
{% endremoveemptylines %}
{% endcapture -%}
{%- capture_script %}
{{ script }}
{% endcapture_script %} {% endcapture_script %}
{% endremoveemptylines %}