mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-21 19:41:05 +08:00
This commit is contained in:
parent
9157a6e6e6
commit
a2635a5520
@ -214,10 +214,18 @@ const editKeydown = (app: App, event: KeyboardEvent) => {
|
|||||||
} else {
|
} else {
|
||||||
protyle = activeTab.model.editors.unRefEdit.protyle;
|
protyle = activeTab.model.editors.unRefEdit.protyle;
|
||||||
}
|
}
|
||||||
} else if (activeTab.model instanceof Custom && activeTab.model.data?.editor instanceof Protyle) {
|
} else if (activeTab.model instanceof Custom && activeTab.model.editors?.length > 0) {
|
||||||
protyle = activeTab.model.data.editor.protyle;
|
if (range) {
|
||||||
} else {
|
activeTab.model.editors.find(item => {
|
||||||
return false;
|
if (item.protyle.element.contains(range.startContainer)) {
|
||||||
|
protyle = item.protyle;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!protyle) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
} else if (!protyle) {
|
} else if (!protyle) {
|
||||||
if (!protyle && range) {
|
if (!protyle && range) {
|
||||||
|
@ -45,7 +45,7 @@ export const newCardModel = (options: {
|
|||||||
cardsData: options.data.cardsData,
|
cardsData: options.data.cardsData,
|
||||||
index: options.data.index,
|
index: options.data.index,
|
||||||
});
|
});
|
||||||
this.data.editor = editor;
|
customObj.editors.push(editor);
|
||||||
// https://github.com/siyuan-note/siyuan/issues/9561#issuecomment-1794473512
|
// https://github.com/siyuan-note/siyuan/issues/9561#issuecomment-1794473512
|
||||||
delete options.data.cardsData;
|
delete options.data.cardsData;
|
||||||
delete options.data.index;
|
delete options.data.index;
|
||||||
@ -75,7 +75,8 @@ export const newCardModel = (options: {
|
|||||||
cardType: this.data.cardType,
|
cardType: this.data.cardType,
|
||||||
cardsData,
|
cardsData,
|
||||||
});
|
});
|
||||||
customObj.data.editor = editor;
|
|
||||||
|
customObj.editors.push(editor);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import {Tab} from "../Tab";
|
import {Tab} from "../Tab";
|
||||||
import {Model} from "../Model";
|
import {Model} from "../Model";
|
||||||
import {App} from "../../index";
|
import {App} from "../../index";
|
||||||
|
import {Protyle} from "../../protyle";
|
||||||
|
|
||||||
export class Custom extends Model {
|
export class Custom extends Model {
|
||||||
public element: Element;
|
public element: Element;
|
||||||
@ -12,6 +13,7 @@ export class Custom extends Model {
|
|||||||
public beforeDestroy: () => void;
|
public beforeDestroy: () => void;
|
||||||
public resize: () => void;
|
public resize: () => void;
|
||||||
public update: () => void;
|
public update: () => void;
|
||||||
|
public editors: Protyle[] = [];
|
||||||
|
|
||||||
constructor(options: {
|
constructor(options: {
|
||||||
app: App,
|
app: App,
|
||||||
|
@ -24,9 +24,9 @@ export const getAllEditor = () => {
|
|||||||
editors.push(item.editors.unRefEdit);
|
editors.push(item.editors.unRefEdit);
|
||||||
});
|
});
|
||||||
models.custom.forEach(item => {
|
models.custom.forEach(item => {
|
||||||
if (item.data?.editor instanceof Protyle) {
|
item.editors?.forEach(eItem => {
|
||||||
editors.push(item.data.editor);
|
editors.push(eItem)
|
||||||
}
|
})
|
||||||
});
|
});
|
||||||
models.backlink.forEach(item => {
|
models.backlink.forEach(item => {
|
||||||
item.editors.forEach(editorItem => {
|
item.editors.forEach(editorItem => {
|
||||||
|
@ -579,8 +579,6 @@ export const layoutToJSON = (layout: Layout | Wnd | Tab | Model, json: any, brea
|
|||||||
json.instance = "Custom";
|
json.instance = "Custom";
|
||||||
json.customModelType = layout.type;
|
json.customModelType = layout.type;
|
||||||
json.customModelData = Object.assign({}, layout.data);
|
json.customModelData = Object.assign({}, layout.data);
|
||||||
// https://github.com/siyuan-note/siyuan/issues/9250
|
|
||||||
delete json.customModelData.editor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layout instanceof Layout || layout instanceof Wnd) {
|
if (layout instanceof Layout || layout instanceof Wnd) {
|
||||||
|
Loading…
Reference in New Issue
Block a user