CcmNG: Some experiments with the TinyMCE API

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@5685 8810af33-2d31-482b-a856-94f89814c4df
jensp 2018-09-02 16:49:01 +00:00
parent 216fd13620
commit 0e09b2256f
2 changed files with 83 additions and 13 deletions

View File

@ -30,18 +30,88 @@ function openDialog(editor) {
console.log("Opening dialog"); console.log("Opening dialog");
editor.windowManager.open( editor.windowManager.open({
{ body: [
body: [ {
{ items: [
label: "Search term", {
name: "searchterm", label: "Search term",
type: "textbox" name: "searchterm",
}, onPostRender: function() {
], this.getEl().value = "Hello there";
onsubmit: function(event) { },
type: "textbox",
},
{
html: `<ul><li id="alpha">eins</li><li id="bravo">zwei</li></ul>`,
onClick: function(event) {
alert(`${event.target.id} clicked.`);
},
type: "container",
}
],
name: "insertmedia_dialog_container",
type: "container",
}, },
title: "Insert media", ],
onsubmit: function(event) {
},
// onPostRender: function(event) {
// console.log(`this = ${this}`);
// console.log(`this.getEl = ${this.getEl}`);
// this.getEl("searchterm").value = "Hello there";
// },
title: "Insert media",
}); });
console.log("Dialog opened.");
// const dialog = editor.windowManager.open(
// body: [
// {
// items: [
// {
// label: "Search term",
// name: "searchterm",
// type: "textbox",
// },
// ],
// name: "insertmedia_dialog_container",
// type: "container",
// },
// ],
// onsubmit: function(event) {
//
// },
// onPostRender: function() {
// this.getEl("searchterm").value = "Hello there";
// },
// title: "Insert media",
// );
// console.log("Dialog opened.");
// dialog.add(
// [
// {
// label: "Group",
// name: "group",
// type: "textbox",
// },
// ],
// );
//
// console.log("Element added");
// dialog.insert([
// {
// label: "Group",
// name: "group",
// type: "textbox",
// },
// ],
// dialog.items().length,
// false);
//
// console.log("element inserted");
} }

View File

@ -10,7 +10,7 @@ tinymce.PluginManager.add("ccm-cms-insertmedia",
text: "Insert media", text: "Insert media",
icon: false, icon: false,
onclick: function() { onclick: function() {
openDialog(editor); const dialog = openDialog(editor);
} }
} }
); );