@chenyomi/leafer-htmltext-editor 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,92 +1,173 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
5
35
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.FontManager = exports.defaultFonts = exports.fontManager = exports.setHTMLText = exports.updataHtmlText = exports.TextEditor = void 0;
7
- exports.initTextEditorQuill = initTextEditorQuill;
8
- const TextEditor_1 = require("./TextEditor");
9
- var TextEditor_2 = require("./TextEditor");
10
- Object.defineProperty(exports, "TextEditor", { enumerable: true, get: function () { return TextEditor_2.TextEditor; } });
11
- require("./TextEditTool");
36
+ exports.quillManager = exports.TextEditor = void 0;
37
+ var TextEditor_1 = require("./TextEditor");
38
+ Object.defineProperty(exports, "TextEditor", { enumerable: true, get: function () { return TextEditor_1.TextEditor; } });
12
39
  const core_1 = require("@leafer-ui/core");
13
- const quill_1 = require("quill");
14
- const quill_2 = __importDefault(require("quill"));
15
- require("quill/dist/quill.core.css");
16
- var utils_1 = require("./utils");
17
- Object.defineProperty(exports, "updataHtmlText", { enumerable: true, get: function () { return utils_1.updataHtmlText; } });
18
- Object.defineProperty(exports, "setHTMLText", { enumerable: true, get: function () { return utils_1.setHTMLText; } });
19
- var font_1 = require("./fonts/font");
20
- Object.defineProperty(exports, "fontManager", { enumerable: true, get: function () { return font_1.fontManager; } });
21
- Object.defineProperty(exports, "defaultFonts", { enumerable: true, get: function () { return font_1.defaultFonts; } });
22
- Object.defineProperty(exports, "FontManager", { enumerable: true, get: function () { return font_1.FontManager; } });
23
- core_1.Plugin.add("leafer-htmltext-editor", "editor");
24
- function initTextEditorQuill(container) {
25
- const textInner = document.getElementById("textInnerEditor");
26
- if (!textInner) {
27
- const el = document.createElement("div");
28
- el.id = "textInnerEditor";
29
- el.style.position = "fixed";
30
- el.style.transformOrigin = "left top";
31
- el.style.overflowWrap = "break-word";
32
- el.style.wordBreak = "break-all";
33
- el.style.visibility = "hidden";
34
- document.body.appendChild(el);
40
+ require("./TextEditTool");
41
+ core_1.Plugin.add('text-editor2', 'editor');
42
+ const quill_1 = __importStar(require("quill"));
43
+ class QuillManager {
44
+ constructor() {
45
+ this.quill = null;
46
+ this.app_ = null;
47
+ }
48
+ static getInstance() {
49
+ if (!QuillManager.instance) {
50
+ QuillManager.instance = new QuillManager();
51
+ }
52
+ return QuillManager.instance;
53
+ }
54
+ init(app) {
55
+ this.app_ = app;
56
+ if (this.quill)
57
+ return this.quill;
58
+ let el = document.getElementById('textInnerEditor');
59
+ if (!el) {
60
+ el = document.createElement('div');
61
+ el.id = 'textInnerEditor';
62
+ el.style.position = 'fixed';
63
+ el.style.transformOrigin = 'left top';
64
+ el.style.overflowWrap = 'break-word';
65
+ el.style.wordBreak = 'break-all';
66
+ el.style.visibility = 'hidden';
67
+ document.body.appendChild(el);
68
+ }
69
+ this.quill = new quill_1.default('#textInnerEditor', {
70
+ theme: undefined,
71
+ modules: {
72
+ toolbar: false,
73
+ keyboard: {
74
+ bindings: {
75
+ enter: {
76
+ key: 'Enter',
77
+ handler: (range) => {
78
+ const [line] = this.quill.getLine(range.index);
79
+ const BlockBlot = quill_1.default.import('blots/block');
80
+ if (!BlockBlot?.bubbleFormats)
81
+ return true;
82
+ const lineFormats = BlockBlot.bubbleFormats(line);
83
+ const delta = new quill_1.Delta().retain(range.index).delete(range.length).insert('\n', lineFormats);
84
+ this.quill.updateContents(delta, quill_1.default.sources.USER);
85
+ this.quill.setSelection(range.index + 1, quill_1.default.sources.SILENT);
86
+ return false;
87
+ }
88
+ }
89
+ }
90
+ }
91
+ }
92
+ });
93
+ this.app_.editor.quill = this.quill;
94
+ this.registerFonts();
95
+ return this.quill;
96
+ }
97
+ getQuill() {
98
+ if (!this.quill) {
99
+ throw new Error('Quill editor not initialized. Call init() first.');
100
+ }
101
+ return this.quill;
102
+ }
103
+ getCanvas() {
104
+ if (!this.app_) {
105
+ throw new Error('app_ editor not initialized. Call init() first.');
106
+ }
107
+ return this.app_;
108
+ }
109
+ registerFonts() {
110
+ const FontAttributor = quill_1.default.import('attributors/class/font');
111
+ FontAttributor.whitelist = [
112
+ 'Roboto',
113
+ 'RobotoMono',
114
+ 'Inter',
115
+ 'OpenSans',
116
+ 'Montserrat',
117
+ 'RobotoCondensed',
118
+ 'Arimo',
119
+ 'NotoSans',
120
+ 'NotoSansSymbols',
121
+ 'Merriweather',
122
+ 'PlayfairDisplay',
123
+ 'NotoSerif',
124
+ 'Lato',
125
+ 'Spectral',
126
+ 'DancingScript',
127
+ 'NotoSansSimplifiedChinese',
128
+ 'NotoSerifSimplifiedChinese',
129
+ 'NotoSansTraditionalChinese',
130
+ 'NotoSansHongKong',
131
+ 'NotoSerifTraditionalChinese',
132
+ 'NotoSerifHongKong',
133
+ 'NotoSansJapanese',
134
+ 'NotoSansKorean',
135
+ 'Poppins'
136
+ ];
137
+ quill_1.default.register(FontAttributor, true);
138
+ }
139
+ isMultiSelect() {
140
+ if (!this.app_.editor)
141
+ return false;
142
+ if (this.app_.editor.multiple === true) {
143
+ return true;
144
+ }
145
+ else {
146
+ return false;
147
+ }
148
+ }
149
+ dateEdit(callback, level = 0, listNew) {
150
+ const { editor } = this.app_;
151
+ const list = listNew ? listNew : editor.leafList.list;
152
+ const applyCallback = (leaf) => {
153
+ if (level && (leaf.tag === 'Box' || leaf.name === 'Text')) {
154
+ callback(leaf.children?.[0] || leaf);
155
+ }
156
+ else {
157
+ callback(leaf);
158
+ }
159
+ };
160
+ if (!list.length)
161
+ return;
162
+ if (Array.isArray(list) && list.length > 1) {
163
+ this.app_.lockLayout();
164
+ list.forEach(applyCallback);
165
+ this.app_.unlockLayout();
166
+ editor.updateEditBox();
167
+ }
168
+ else {
169
+ applyCallback(list[0]);
170
+ }
35
171
  }
36
- TextEditor_1.TextEditor.quill = new quill_2.default("#textInnerEditor", {
37
- theme: null,
38
- modules: {
39
- toolbar: false,
40
- keyboard: {
41
- bindings: {
42
- enter: {
43
- key: "Enter",
44
- handler: (range, context) => {
45
- const [line] = TextEditor_1.TextEditor.quill.getLine(range.index);
46
- const BlockBlot = quill_2.default.import("blots/block");
47
- if (!BlockBlot || !BlockBlot.bubbleFormats)
48
- return;
49
- const lineFormats = BlockBlot.bubbleFormats(line);
50
- const delta = new quill_1.Delta()
51
- .retain(range.index)
52
- .delete(range.length)
53
- .insert("\n", lineFormats);
54
- TextEditor_1.TextEditor.quill.updateContents(delta, quill_2.default.sources.USER);
55
- TextEditor_1.TextEditor.quill.setSelection(range.index + 1, quill_2.default.sources.SILENT);
56
- return false;
57
- },
58
- },
59
- },
60
- },
61
- },
62
- });
63
- const FontAttributor = quill_2.default.import("attributors/class/font");
64
- FontAttributor.whitelist = [
65
- "Roboto",
66
- "RobotoMono",
67
- "Inter",
68
- "OpenSans",
69
- "Montserrat",
70
- "RobotoCondensed",
71
- "Arimo",
72
- "NotoSans",
73
- "NotoSansSymbols",
74
- "Merriweather",
75
- "PlayfairDisplay",
76
- "NotoSerif",
77
- "Lato",
78
- "Spectral",
79
- "DancingScript",
80
- "NotoSansSimplifiedChinese",
81
- "NotoSerifSimplifiedChinese",
82
- "NotoSansTraditionalChinese",
83
- "NotoSansHongKong",
84
- "NotoSerifTraditionalChinese",
85
- "NotoSerifHongKong",
86
- "NotoSansJapanese",
87
- "NotoSansKorean",
88
- "Poppins",
89
- ];
90
- quill_2.default.register(FontAttributor, true);
91
- return TextEditor_1.TextEditor.quill;
92
172
  }
173
+ exports.quillManager = QuillManager.getInstance();
package/dist/utils.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export declare const updataHtmlText: (e?: any, base64font?: any, fontObj?: any) => Promise<void>;
2
- export declare const setHTMLText: (key: string, value?: any, base64font?: any, editor?: any, isInnerEditor?: boolean) => void;
2
+ export declare const setHTMLText: (key: string, value?: any, base64font?: any) => void;
3
3
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,cAAc,GAAU,IAAI,GAAG,EAAE,aAAa,GAAG,EAAE,UAAU,GAAG,kBAuG5E,CAAC;AAqFF,eAAO,MAAM,WAAW,GACtB,KAAK,MAAM,EACX,QAAQ,GAAG,EACX,aAAa,GAAG,EAChB,SAAS,GAAG,EACZ,gBAAgB,OAAO,SAgIxB,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,GAAU,IAAI,GAAG,EAAE,aAAa,GAAG,EAAE,UAAU,GAAG,kBAgG5E,CAAA;AAmED,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,EAAE,QAAQ,GAAG,EAAE,aAAa,GAAG,SA+HrE,CAAA"}
package/dist/utils.js CHANGED
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setHTMLText = exports.updataHtmlText = void 0;
4
- const TextEditor_1 = require("./TextEditor");
5
- function getEditorContext() {
6
- const quill = TextEditor_1.TextEditor.quill;
7
- return { quill };
8
- }
4
+ const _1 = require(".");
9
5
  const updataHtmlText = async (e, base64font, fontObj) => {
10
6
  const { scaleX, scaleY } = e.worldTransform;
11
7
  const zoomScale = Math.max(Math.abs(scaleX), Math.abs(scaleY));
@@ -25,18 +21,14 @@ const updataHtmlText = async (e, base64font, fontObj) => {
25
21
  if (dom && e.data.textData?.textShadow) {
26
22
  dom.style.textShadow = e.data.textData.textShadow;
27
23
  }
28
- else if (dom) {
24
+ else {
29
25
  dom.style.textShadow = 'none';
30
26
  }
31
27
  if (dom && e.data.textData?.alignContent) {
32
28
  const qlEditor = dom.querySelector('.ql-editor');
33
- if (qlEditor) {
34
- qlEditor.style.alignContent = e.data.textData.alignContent;
35
- }
29
+ qlEditor.style.alignContent = e.data.textData.alignContent;
36
30
  }
37
- const { quill } = getEditorContext();
38
- if (!quill)
39
- return;
31
+ const quill = _1.quillManager.getQuill();
40
32
  const html = quill.getSemanticHTML();
41
33
  if (html === '<p></p>') {
42
34
  if (e.text.includes('<style>@font-face')) {
@@ -76,9 +68,6 @@ const updataHtmlText = async (e, base64font, fontObj) => {
76
68
  };
77
69
  exports.updataHtmlText = updataHtmlText;
78
70
  const addFontSizeToP = (e, html, fontSize = 16, lineHeight = '1.5', letterSpacing = '0', textShadow = 'none', alignContent = 'start') => {
79
- const { quill } = getEditorContext();
80
- if (!quill)
81
- return html;
82
71
  const { scaleX, scaleY } = e.worldTransform;
83
72
  const zoomScale = Math.max(Math.abs(scaleX), Math.abs(scaleY));
84
73
  const wrapper = document.createElement('div');
@@ -98,6 +87,7 @@ const addFontSizeToP = (e, html, fontSize = 16, lineHeight = '1.5', letterSpacin
98
87
  }
99
88
  let height;
100
89
  const div = document.querySelector('#textInnerEditor');
90
+ const quill = _1.quillManager.getQuill();
101
91
  const actualHeight = Number((quill.scroll.domNode.scrollHeight / zoomScale).toFixed(0));
102
92
  const actualWidth = Number((quill.scroll.domNode.scrollWidth / zoomScale).toFixed(0));
103
93
  if (['center', 'end'].includes(e.data.textData.alignContent)) {
@@ -117,7 +107,7 @@ const addFontSizeToP = (e, html, fontSize = 16, lineHeight = '1.5', letterSpacin
117
107
  height = `${e.parent.height}px`;
118
108
  }
119
109
  }
120
- const style = `<style>sub,sup{font-size:63%;}.ql-ui{position:absolute}ol,ul{counter-reset:list-0;padding-left:1.5em;margin:0}ol>li,ul>li{counter-increment:list-0;list-style-type:none;position:relative;padding-left:0;margin:0}ol>li::before{content:counter(list-0,decimal) '. ';position:absolute;left:-1.5em;width:1.2em;text-align:right}ul>li::before{content:'\\u2022';position:absolute;left:-1.5em;width:1.2em;text-align:right}li[data-list]{counter-set:list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9}.ql-align-center{text-align:center}.ql-align-right{text-align:right}.ql-align-left{text-align:left}.ql-align-justify{text-align:justify}</style>`;
110
+ const style = `<style>sub,sup{font-size:63%;}.ql-ui{position:absolute}ol,ul{counter-reset:list-0;padding-left:1.5em;margin:0}ol>li,ul>li{counter-increment:list-0;list-style-type:none;position:relative;padding-left:0;margin:0}ol>li::before{content:counter(list-0,decimal) '. ';position:absolute;left:-1.5em;width:1.2em;text-align:right}ul>li::before{content:'\u2022';position:absolute;left:-1.5em;width:1.2em;text-align:right}li[data-list]{counter-set:list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9}.ql-align-center{text-align:center}.ql-align-right{text-align:right}.ql-align-left{text-align:left}.ql-align-justify{text-align:justify}</style>`;
121
111
  let divBox = '';
122
112
  if (e.parent.children[0].tag.includes('Shape')) {
123
113
  divBox =
@@ -140,25 +130,18 @@ const addFontSizeToP = (e, html, fontSize = 16, lineHeight = '1.5', letterSpacin
140
130
  console.log(divBox, '最终的html内容');
141
131
  return divBox;
142
132
  };
143
- const setHTMLText = (key, value, base64font, editor, isInnerEditor) => {
144
- const { quill } = getEditorContext();
133
+ const setHTMLText = (key, value, base64font) => {
134
+ const quill = _1.quillManager.getQuill();
135
+ const { editor, canvas } = _1.quillManager.getCanvas();
136
+ console.log(editor, _1.quillManager.getCanvas(), 'editor');
145
137
  if (!quill) {
146
- console.error('Quill editor not initialized');
147
138
  return;
148
139
  }
149
- const rangeStr = localStorage.getItem('selection-change');
150
- const range = rangeStr ? JSON.parse(rangeStr) : null;
151
- if (range && isInnerEditor) {
152
- quill.setSelection(range.index, range.length);
153
- }
154
- if (!editor || !editor.dateEdit) {
155
- console.warn('Editor context not available for dateEdit');
156
- return;
157
- }
158
- editor.dateEdit(async (e) => {
140
+ const range = JSON.parse(localStorage.getItem('selection-change') || '{}');
141
+ _1.quillManager.dateEdit(async (e) => {
159
142
  if (key === 'font') {
160
143
  const fontSimpleName = value.code.replace(/\s+/g, '');
161
- if (isInnerEditor) {
144
+ if (editor.innerEditing) {
162
145
  if (range && range.length) {
163
146
  quill.formatText(range.index, range.length, key, fontSimpleName);
164
147
  }
@@ -168,18 +151,18 @@ const setHTMLText = (key, value, base64font, editor, isInnerEditor) => {
168
151
  (0, exports.updataHtmlText)(e, base64font ?? null, value ?? null);
169
152
  }
170
153
  else {
171
- editor.isMultiSelect && editor.isMultiSelect() && quill.clipboard.dangerouslyPasteHTML(e.text);
154
+ _1.quillManager.isMultiSelect() && quill.clipboard.dangerouslyPasteHTML(e.text);
172
155
  quill.formatText(0, quill.getLength() - 1, key, fontSimpleName);
173
156
  (0, exports.updataHtmlText)(e, base64font ?? null, value ?? null);
174
157
  }
175
158
  }
176
159
  else if (key === 'fontSize') {
177
160
  e.data.textData[key] = value;
178
- editor.isMultiSelect && editor.isMultiSelect() && quill.clipboard.dangerouslyPasteHTML(e.text);
161
+ _1.quillManager.isMultiSelect() && quill.clipboard.dangerouslyPasteHTML(e.text);
179
162
  (0, exports.updataHtmlText)(e, base64font ?? null);
180
163
  }
181
164
  else if (key === 'textCase') {
182
- if (isInnerEditor && range) {
165
+ if (editor.innerEditing) {
183
166
  const text = quill.getText(range.index, range.length);
184
167
  const formats = quill.getFormat(range.index, range.length);
185
168
  quill.deleteText(range.index, range.length);
@@ -194,16 +177,14 @@ const setHTMLText = (key, value, base64font, editor, isInnerEditor) => {
194
177
  convertedText = text.toUpperCase();
195
178
  }
196
179
  quill.insertText(range.index, convertedText, formats);
197
- if (range && isInnerEditor) {
198
- quill.setSelection(range.index, range.length);
199
- }
180
+ range && editor.innerEditing && quill.setSelection(range.index, range.length);
200
181
  }
201
182
  }
202
183
  else if (key === 'script') {
203
184
  let val = 'sub';
204
185
  if (value === 'super')
205
186
  val = 'sup';
206
- if (isInnerEditor) {
187
+ if (editor.innerEditing) {
207
188
  if (range && range.length) {
208
189
  quill.formatText(range.index, range.length, key, quill.getFormat(range).script === value ? false : val);
209
190
  }
@@ -212,14 +193,14 @@ const setHTMLText = (key, value, base64font, editor, isInnerEditor) => {
212
193
  }
213
194
  }
214
195
  else {
215
- editor.isMultiSelect && editor.isMultiSelect() && quill.clipboard.dangerouslyPasteHTML(e.text);
196
+ _1.quillManager.isMultiSelect() && quill.clipboard.dangerouslyPasteHTML(e.text);
216
197
  quill.formatText(0, quill.getLength() - 1, key, quill.getFormat().script === value ? false : val);
217
198
  (0, exports.updataHtmlText)(e);
218
199
  }
219
200
  }
220
201
  else if (key === 'align') {
221
- editor.isMultiSelect && editor.isMultiSelect() && quill.clipboard.dangerouslyPasteHTML(e.text);
222
- if (isInnerEditor) {
202
+ _1.quillManager.isMultiSelect() && quill.clipboard.dangerouslyPasteHTML(e.text);
203
+ if (editor.innerEditing) {
223
204
  quill.format(key, value);
224
205
  }
225
206
  else {
@@ -228,28 +209,28 @@ const setHTMLText = (key, value, base64font, editor, isInnerEditor) => {
228
209
  (0, exports.updataHtmlText)(e);
229
210
  }
230
211
  else if (key === 'alignContent') {
231
- editor.isMultiSelect && editor.isMultiSelect() && quill.clipboard.dangerouslyPasteHTML(e.text);
212
+ _1.quillManager.isMultiSelect() && quill.clipboard.dangerouslyPasteHTML(e.text);
232
213
  e.data.textData[key] = value;
233
214
  (0, exports.updataHtmlText)(e);
234
215
  }
235
216
  else if (key === 'color') {
236
- editor.isMultiSelect && editor.isMultiSelect() && quill.clipboard.dangerouslyPasteHTML(e.text);
217
+ _1.quillManager.isMultiSelect() && quill.clipboard.dangerouslyPasteHTML(e.text);
237
218
  quill.formatText(0, quill.getLength() - 1, key, value);
238
219
  if (e.tag === 'HTMLText') {
239
220
  (0, exports.updataHtmlText)(e);
240
221
  }
241
- else if (e.parent.findOne && e.parent.findOne('HTMLText')) {
222
+ else if (e.parent.findOne('HTMLText')) {
242
223
  (0, exports.updataHtmlText)(e.parent.findOne('HTMLText'));
243
224
  }
244
225
  }
245
226
  else if (key === 'textShadow') {
246
- editor.isMultiSelect && editor.isMultiSelect() && quill.clipboard.dangerouslyPasteHTML(e.text);
227
+ _1.quillManager.isMultiSelect() && quill.clipboard.dangerouslyPasteHTML(e.text);
247
228
  e.data.textData[key] = value;
248
229
  (0, exports.updataHtmlText)(e);
249
230
  }
250
231
  else if (key === 'list') {
251
- editor.isMultiSelect && editor.isMultiSelect() && quill.clipboard.dangerouslyPasteHTML(e.text);
252
- if (isInnerEditor) {
232
+ _1.quillManager.isMultiSelect() && quill.clipboard.dangerouslyPasteHTML(e.text);
233
+ if (editor.innerEditing) {
253
234
  const [line] = quill.getLine(range?.index || 0);
254
235
  if (line.formats().list) {
255
236
  quill.format(key, false);
@@ -270,7 +251,7 @@ const setHTMLText = (key, value, base64font, editor, isInnerEditor) => {
270
251
  (0, exports.updataHtmlText)(e);
271
252
  }
272
253
  else {
273
- if (isInnerEditor) {
254
+ if (editor.innerEditing) {
274
255
  if (range && range.length) {
275
256
  quill.formatText(range.index, range.length, key, !quill.getFormat(range)[key]);
276
257
  }
@@ -279,7 +260,7 @@ const setHTMLText = (key, value, base64font, editor, isInnerEditor) => {
279
260
  }
280
261
  }
281
262
  else {
282
- editor.isMultiSelect && editor.isMultiSelect() && quill.clipboard.dangerouslyPasteHTML(e.text);
263
+ _1.quillManager.isMultiSelect() && quill.clipboard.dangerouslyPasteHTML(e.text);
283
264
  quill.formatText(0, quill.getLength() - 1, key, !quill.getFormat()[key]);
284
265
  (0, exports.updataHtmlText)(e);
285
266
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chenyomi/leafer-htmltext-editor",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A text editor plugin for Leafer UI with HTML text support and Quill integration",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -32,14 +32,14 @@
32
32
  },
33
33
  "homepage": "https://github.com/yourusername/leafer-htmltext-editor#readme",
34
34
  "peerDependencies": {
35
- "@leafer-ui/core": ">=1.0.0",
36
35
  "@leafer-in/editor": ">=1.0.0",
37
- "@leafer-in/interface": ">=1.0.0",
38
36
  "@leafer-in/html": ">=1.0.0",
37
+ "@leafer-ui/core": ">=1.0.0",
39
38
  "leafer-ui": ">=1.0.0",
40
39
  "quill": ">=2.0.0"
41
40
  },
42
41
  "devDependencies": {
42
+ "@types/lodash": "^4.17.23",
43
43
  "@types/node": "^20.0.0",
44
44
  "typescript": "^5.0.0"
45
45
  },