Insert table now working for cms editor
parent
df4cab4b5c
commit
61e6d6945c
|
|
@ -791,6 +791,9 @@ tabindex="-1"
|
||||||
</button>-->
|
</button>-->
|
||||||
</div>
|
</div>
|
||||||
<!--<div class="modal-body">-->
|
<!--<div class="modal-body">-->
|
||||||
|
<div class="cms-tiptap-editor"
|
||||||
|
data-locale="#{cc.attrs.selectedLocale}"
|
||||||
|
data-variant-url="#{cc.attrs.variantUrl}/#{cc.attrs.selectedLocale}">
|
||||||
<div class="cms-tiptap-editor-buttons d-flex mb-1">
|
<div class="cms-tiptap-editor-buttons d-flex mb-1">
|
||||||
<div class="px-2 cms-tiptap-editor-textformatting">
|
<div class="px-2 cms-tiptap-editor-textformatting">
|
||||||
<button
|
<button
|
||||||
|
|
@ -939,7 +942,7 @@ tabindex="-1"
|
||||||
<button
|
<button
|
||||||
class="
|
class="
|
||||||
btn btn-outline-dark
|
btn btn-outline-dark
|
||||||
tiptab-insert-table
|
tiptap-insert-table
|
||||||
"
|
"
|
||||||
data-target="#insert-table-dialog"
|
data-target="#insert-table-dialog"
|
||||||
data-toggle="modal"
|
data-toggle="modal"
|
||||||
|
|
@ -1007,6 +1010,8 @@ tabindex="-1"
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
class="btn btn-success"
|
class="btn btn-success"
|
||||||
|
data-dismiss="modal"
|
||||||
|
data-backdrop="false"
|
||||||
type="submit"
|
type="submit"
|
||||||
>
|
>
|
||||||
#{CmsDefaultStepsMessageBundle['cms_editor.dialogs.insert_table.submit']}
|
#{CmsDefaultStepsMessageBundle['cms_editor.dialogs.insert_table.submit']}
|
||||||
|
|
@ -1017,7 +1022,7 @@ tabindex="-1"
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="cms-tiptap-editor border"
|
<div class="cms-tiptap-editor-canvas border"
|
||||||
data-locale="#{cc.attrs.selectedLocale}"
|
data-locale="#{cc.attrs.selectedLocale}"
|
||||||
data-variant-url="#{cc.attrs.variantUrl}"></div>
|
data-variant-url="#{cc.attrs.variantUrl}"></div>
|
||||||
<!--</div>-->
|
<!--</div>-->
|
||||||
|
|
@ -1035,6 +1040,7 @@ tabindex="-1"
|
||||||
#{cc.attrs.editDialogSubmitLabel}
|
#{cc.attrs.editDialogSubmitLabel}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<!--</div>
|
<!--</div>
|
||||||
</div>
|
</div>
|
||||||
</div>-->
|
</div>-->
|
||||||
|
|
|
||||||
|
|
@ -13,4 +13,15 @@
|
||||||
margin: 0.33em;
|
margin: 0.33em;
|
||||||
padding: 0.2em;
|
padding: 0.2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
border: 1px solid #000;
|
||||||
|
margin-left: 0.2em;
|
||||||
|
margin-right: 0.2em;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
td, th, tr {
|
||||||
|
border: 1px solid #000;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -94,8 +94,14 @@ async function initEditor(editorElem: HTMLElement) {
|
||||||
const variant = await fetchVariant(variantUrl);
|
const variant = await fetchVariant(variantUrl);
|
||||||
console.log("Got variant");
|
console.log("Got variant");
|
||||||
|
|
||||||
|
const canvasElem = editorElem.querySelector(".cms-tiptap-editor-canvas");
|
||||||
|
if (!canvasElem) {
|
||||||
|
console.error("canvasElem not found.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const editor = new Editor({
|
const editor = new Editor({
|
||||||
element: editorElem,
|
element: canvasElem,
|
||||||
extensions: [
|
extensions: [
|
||||||
Gapcursor,
|
Gapcursor,
|
||||||
StarterKit,
|
StarterKit,
|
||||||
|
|
@ -244,6 +250,7 @@ function initEditorButtons(editor: Editor, buttonsElem: Element) {
|
||||||
.focus()
|
.focus()
|
||||||
.insertTable({ cols: cols, rows: rows, headerRow: headerRow })
|
.insertTable({ cols: cols, rows: rows, headerRow: headerRow })
|
||||||
.run();
|
.run();
|
||||||
|
$("#insert-table-dialog").modal("hide");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue