delete layout element
This commit is contained in:
@@ -115,5 +115,6 @@ export class UmbBlockRteEntriesContext extends UmbBlockEntriesContext<
|
||||
async delete(contentUdi: string) {
|
||||
// TODO: Loop through children and delete them as well?
|
||||
await super.delete(contentUdi);
|
||||
this._manager?.deleteLayoutElement(contentUdi);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,18 @@ export class UmbBlockRteManagerContext<
|
||||
this.#editor = editor;
|
||||
}
|
||||
|
||||
getTinyMceEditor() {
|
||||
return this.#editor;
|
||||
}
|
||||
|
||||
removeOneLayout(contentUdi: string) {
|
||||
this._layouts.removeOne(contentUdi);
|
||||
}
|
||||
|
||||
getLayouts(): Array<BlockLayoutType> {
|
||||
return this._layouts.getValue();
|
||||
}
|
||||
|
||||
create(
|
||||
contentElementTypeKey: string,
|
||||
partialLayoutEntry?: Omit<BlockLayoutType, 'contentUdi'>,
|
||||
@@ -65,4 +77,16 @@ export class UmbBlockRteManagerContext<
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
public deleteLayoutElement(contentUdi: string) {
|
||||
if (!this.#editor) return;
|
||||
|
||||
const blockElementsOfThisUdi = this.#editor.dom.select(
|
||||
`umb-rte-block[data-content-udi='${contentUdi}'], umb-rte-block-inline[data-content-udi='${contentUdi}']`,
|
||||
);
|
||||
blockElementsOfThisUdi.forEach((blockElement) => {
|
||||
this.#editor?.dom.remove(blockElement);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user