From 6b35cd66cef1ad2331051972f275fc0d965bea98 Mon Sep 17 00:00:00 2001 From: zwx1126739 Date: Tue, 8 Oct 2024 22:08:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A4=87=E5=BF=98=E5=BD=95?= =?UTF-8?q?=E5=AD=97=E4=BD=93=E5=BC=82=E5=B8=B8=E5=8F=98=E5=8C=96=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zwx1126739 --- .../src/main/resources/rawfile/rich_editor.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/common/resources/src/main/resources/rawfile/rich_editor.js b/common/resources/src/main/resources/rawfile/rich_editor.js index 216ab6c..9f803fb 100644 --- a/common/resources/src/main/resources/rawfile/rich_editor.js +++ b/common/resources/src/main/resources/rawfile/rich_editor.js @@ -104,7 +104,9 @@ RICH_EDITOR.setNumbers = function () { if (listStyle === 'decimal') { return; } + let fontSize = document.queryCommandValue('fontSize'); document.execCommand('insertOrderedList', false, null); + document.execCommand('fontSize', false, fontSize); var selection; var type; if (window.getSelection) { @@ -135,7 +137,9 @@ RICH_EDITOR.setABC = function () { if (listStyle === 'lower-alpha') { return; } + let fontSize = document.queryCommandValue('fontSize'); document.execCommand('insertOrderedList', false, null); + document.execCommand('fontSize', false, fontSize); var selection; var type; if (window.getSelection) { @@ -166,7 +170,9 @@ RICH_EDITOR.setBullets = function () { if (listStyle === 'disc') { return; } + let fontSize = document.queryCommandValue('fontSize'); document.execCommand('insertUnorderedList', false, null); + document.execCommand('fontSize', false, fontSize); var selection; var type; if (window.getSelection) { @@ -197,7 +203,9 @@ RICH_EDITOR.setSquare = function () { if (listStyle === 'square') { return; } + let fontSize = document.queryCommandValue('fontSize'); document.execCommand('insertUnorderedList', false, null); + document.execCommand('fontSize', false, fontSize); var selection; var type; if (window.getSelection) { @@ -280,18 +288,21 @@ RICH_EDITOR.setOutdent = function () { }; RICH_EDITOR.setJustifyLeft = function () { + let fontSize = document.queryCommandValue('fontSize'); document.execCommand('justifyLeft', false, null); - RICH_EDITOR.editor.setAttribute('style', 'text-align: left;'); + document.execCommand('fontSize', false, fontSize); }; RICH_EDITOR.setJustifyCenter = function () { + let fontSize = document.queryCommandValue('fontSize'); document.execCommand('justifyCenter', false, null); - RICH_EDITOR.editor.setAttribute('style', 'text-align: center;'); + document.execCommand('fontSize', false, fontSize); }; RICH_EDITOR.setJustifyRight = function () { + let fontSize = document.queryCommandValue('fontSize'); document.execCommand('justifyRight', false, null); - RICH_EDITOR.editor.setAttribute('style', 'text-align: right;'); + document.execCommand('fontSize', false, fontSize); }; RICH_EDITOR.insertImage = function (url) { -- Gitee