From a0b4713b0cdf088516d3f53873340aba821b5eaf Mon Sep 17 00:00:00 2001 From: Sahatsawat Kanpai Date: Mon, 20 Jan 2025 21:45:18 +0700 Subject: [PATCH] =?UTF-8?q?=E2=9A=A0=20=20javascript/typescript=20dom=20do?= =?UTF-8?q?=20not=20touch=20doc.style.=20because=20it=20will=20turns=20the?= =?UTF-8?q?=20content=20to=20escaping=20characters=20and=20cannot=20proces?= =?UTF-8?q?s=20furthur=20more=20for=20put=20those=20into=20ckeditor=20supp?= =?UTF-8?q?ort,=20because=20even=20using=20.replace=20or=20try=20to=20chan?= =?UTF-8?q?ge=20those=20escaping=20characters=20will=20also=20not=20workin?= =?UTF-8?q?g=20for=20them=20and=20no=20way=20to=20apply=20on=20them=20anym?= =?UTF-8?q?ore=20for=20examples=20"=20which=20is=20for=20single=20quo?= =?UTF-8?q?te=20'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sample/ckeditor.ts | 29 ++++++++++++++++------------- sample/index.html | 26 +++++++++++++------------- src/import.ts | 4 ++-- 3 files changed, 31 insertions(+), 28 deletions(-) diff --git a/sample/ckeditor.ts b/sample/ckeditor.ts index 4094771..fb1f82e 100644 --- a/sample/ckeditor.ts +++ b/sample/ckeditor.ts @@ -140,19 +140,22 @@ ClassicEditor fontFamily: { options: [ 'default', - 'Arial, sans-serif', - 'Georgia, serif', - 'Impact, Charcoal, sans-serif', - 'Lucida Console, Monaco, monospace', - 'Lucida Sans Unicode, Lucida Grande, sans-serif', - 'Tahoma, Geneva, sans-serif', - 'Times New Roman, Times, serif', - 'Trebuchet MS, Helvetica, sans-serif', - 'Verdana, Geneva, sans-serif', - 'TH Sarabun New, sans-serif', - 'Angsana New, serif', - 'EucrosiaUPC, serif', - 'Noto Sans Thai, sans-serif' + // let's add some microsoft word fonts by dictionary but not too much + 'Angsana New', + 'AngsanaUPC', + 'Arial', + 'EucrosiaUPC', + 'FreesiaUPC', + 'JasmineUPC', + 'KodchiangUPC', + 'Leelawadee', + 'Leelawadee UI', + 'Microsoft Sans Serif', + 'PMingLiU', + 'Tahoma', + 'Times New Roman', + 'Trebuchet MS', + 'Verdana' ] }, mathlive: { diff --git a/sample/index.html b/sample/index.html index ac31c8f..49f3dac 100644 --- a/sample/index.html +++ b/sample/index.html @@ -19,33 +19,33 @@

CKEditor 5 – Development Sample

-

ในการทดลองวัดความยาวของวัตถุชิ้นหนึ่งที่มีความยาวประมาณ +

ในการทดลองวัดความยาวของวัตถุชิ้นหนึ่งที่มีความยาวประมาณ 6 เซนติเมตร ด้วยไม้บรรทัดที่มีความละเอียด 0.1 เซนติเมตร โดยทำการวัดทั้งหมด 5 ครั้ง ได้ข้อมูลดังนี้

-

5.84 6.00 6.26 5.90 +

5.84 6.00 6.26 5.90 12.25

-

ถ้าจะต้องรายงานค่าเฉลี่ยของการวัดความยาวครั้งนี้ ถ้าจะต้องรายงานค่าเฉลี่ยของการวัดความยาวครั้งนี้      และรายงานความคลายเคลื่อนของความยาวเฉลี่ย และรายงานความคลายเคลื่อนของความยาวเฉลี่ย      - ด้วยสูตร

+ ด้วยสูตร

   -  

-

เมื่อ  

+

เมื่อ      - และ และ      - คือ ค่าที่มากที่สุด + คือ ค่าที่มากที่สุด และค่าที่น้อยที่สุดของข้อมูล ตามลำดับ

-

ข้อใดแสดงผลการรายงานการวัดความยาวได้ถูกต้อง +

ข้อใดแสดงผลการรายงานการวัดความยาวได้ถูกต้อง

diff --git a/src/import.ts b/src/import.ts index c65c01f..f909e87 100644 --- a/src/import.ts +++ b/src/import.ts @@ -79,13 +79,13 @@ export default class Import extends Plugin { // font-family for concat with , serif const spans = body.querySelectorAll("span"); spans.forEach(span => { - span.style.fontFamily += ", serif"; + // span.style.fontFamily += ", serif"; // check if it's

tag has font-size attribute, then apply to tag const p = span.parentElement; if (p && p.tagName === "P") { const fontSize = p.style.fontSize; if (fontSize) { - span.style.fontSize = fontSize; + span.setAttribute("style", `${span.getAttribute("style")}; font-size: ${fontSize}`); } } });