mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-30 01:27:26 +08:00
1 parent
0aed2a5609
commit
a0dff862f1
1 file changed
+6
-1
@@ -1757,6 +1757,10 @@ export class CanvasEditor {
|
|||||||
const editing = this.input;
|
const editing = this.input;
|
||||||
if (!editing?.source || editing.composing || editing.saving) return;
|
if (!editing?.source || editing.composing || editing.saving) return;
|
||||||
const value = editTextValue(editing.input), font = editing.fontData, size = editing.style?.size || editing.item.size, reflow = !!editing.reflow;
|
const value = editTextValue(editing.input), font = editing.fontData, size = editing.style?.size || editing.item.size, reflow = !!editing.reflow;
|
||||||
|
if (value === "") {
|
||||||
|
this.setTextError(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const current = () => this.input === editing && !editing.rich && !editing.composing && !editing.saving && editing.fontData === font
|
const current = () => this.input === editing && !editing.rich && !editing.composing && !editing.saving && editing.fontData === font
|
||||||
&& (editing.style?.size || editing.item.size) === size && !!editing.reflow === reflow && editTextValue(editing.input) === value;
|
&& (editing.style?.size || editing.item.size) === size && !!editing.reflow === reflow && editTextValue(editing.input) === value;
|
||||||
try {
|
try {
|
||||||
@@ -1895,7 +1899,8 @@ export class CanvasEditor {
|
|||||||
editing.input.contentEditable = "false";
|
editing.input.contentEditable = "false";
|
||||||
let saved = false;
|
let saved = false;
|
||||||
try {
|
try {
|
||||||
saved = editing.rich ? await this.options.onCommitRichText(editing.item, editing.rich.model, editing.rich.fonts)
|
saved = value === "" && !editing.item.draft ? await this.options.onDelete(editing.item)
|
||||||
|
: editing.rich ? await this.options.onCommitRichText(editing.item, editing.rich.model, editing.rich.fonts)
|
||||||
: await this.options.onCommitText(editing.style ? { ...editing.item, ...editing.style } : editing.item, value, editing.fontData, editing.style?.color ?? null, !!editing.reflow);
|
: await this.options.onCommitText(editing.style ? { ...editing.item, ...editing.style } : editing.item, value, editing.fontData, editing.style?.color ?? null, !!editing.reflow);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (this.input === editing) this.setTextError(error);
|
if (this.input === editing) this.setTextError(error);
|
||||||
|
|||||||
Reference in new issue
Block a user