diff --git a/frappe/public/css/desk-rtl.css b/frappe/public/css/desk-rtl.css index 31321be17d..a38f6864ff 100644 --- a/frappe/public/css/desk-rtl.css +++ b/frappe/public/css/desk-rtl.css @@ -110,4 +110,9 @@ ul.tree-children { } .section-header { direction: ltr; +} + +.ql-editor { + direction: rtl; + text-align: right; } \ No newline at end of file diff --git a/frappe/public/js/frappe/form/controls/code.js b/frappe/public/js/frappe/form/controls/code.js index 60825c82ad..726a83db72 100644 --- a/frappe/public/js/frappe/form/controls/code.js +++ b/frappe/public/js/frappe/form/controls/code.js @@ -39,7 +39,7 @@ frappe.ui.form.ControlCode = frappe.ui.form.ControlText.extend({ toggle_label() { const button_label = this.expanded ? __('Collapse') : __('Expand'); - this.$expand_button.text(button_label); + this.$expand_button && this.$expand_button.text(button_label); }, set_language() { diff --git a/frappe/public/js/frappe/form/controls/text_editor.js b/frappe/public/js/frappe/form/controls/text_editor.js index 5e73889490..3c0f7d5110 100644 --- a/frappe/public/js/frappe/form/controls/text_editor.js +++ b/frappe/public/js/frappe/form/controls/text_editor.js @@ -1,10 +1,5 @@ import Quill from 'quill'; -// replace

tag with

-const Block = Quill.import('blots/block'); -Block.tagName = 'DIV'; -Quill.register(Block, true); - const CodeBlockContainer = Quill.import('formats/code-block-container'); CodeBlockContainer.tagName = 'PRE'; Quill.register(CodeBlockContainer, true); @@ -17,7 +12,8 @@ Table.create = (value) => { node.classList.add('table'); node.classList.add('table-bordered'); return node; -} +}; + Quill.register(Table, true); // link without href @@ -28,7 +24,7 @@ class MyLink extends Link { let node = super.create(value); value = this.sanitize(value); node.setAttribute('href', value); - if(value.startsWith('/') || value.indexOf(window.location.host)) { + if (value.startsWith('/') || value.indexOf(window.location.host)) { // no href if internal link node.removeAttribute('target'); } @@ -73,7 +69,7 @@ Quill.register(CustomColor, true); frappe.ui.form.ControlTextEditor = frappe.ui.form.ControlCode.extend({ make_wrapper() { this._super(); - this.$wrapper.find(".like-disabled-input").addClass('text-editor-print'); + this.$wrapper.find(".like-disabled-input").addClass('ql-editor'); }, make_input() { @@ -203,91 +199,9 @@ frappe.ui.form.ControlTextEditor = frappe.ui.form.ControlCode.extend({ get_input_value() { let value = this.quill ? this.quill.root.innerHTML : ''; - // quill keeps ol as a common container for both type of lists - // and uses css for appearances, this is not semantic - // so we convert ol to ul if it is unordered - const $value = $(`
${value}
`); - $value.find('ol li[data-list=bullet]:first-child').each((i, li) => { - let $li = $(li); - let $parent = $li.parent(); - let $children = $parent.children(); - let $ul = $('