From 0e09b2256fbba6d02ef4bae8ac2054625f2a58b3 Mon Sep 17 00:00:00 2001 From: jensp Date: Sun, 2 Sep 2018 16:49:01 +0000 Subject: [PATCH] CcmNG: Some experiments with the TinyMCE API git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@5685 8810af33-2d31-482b-a856-94f89814c4df --- .../ccm-cms/tinymce/plugins/insertmedia.js | 94 ++++++++++++++++--- .../typescript.off/ccm-cms/ccm-cms-tinymce.ts | 2 +- 2 files changed, 83 insertions(+), 13 deletions(-) diff --git a/ccm-cms-tinymce/src/main/resources/scripts/ccm-cms/tinymce/plugins/insertmedia.js b/ccm-cms-tinymce/src/main/resources/scripts/ccm-cms/tinymce/plugins/insertmedia.js index 4d98b93f3..37d550a17 100644 --- a/ccm-cms-tinymce/src/main/resources/scripts/ccm-cms/tinymce/plugins/insertmedia.js +++ b/ccm-cms-tinymce/src/main/resources/scripts/ccm-cms/tinymce/plugins/insertmedia.js @@ -30,18 +30,88 @@ function openDialog(editor) { console.log("Opening dialog"); - editor.windowManager.open( - { - body: [ - { - label: "Search term", - name: "searchterm", - type: "textbox" - }, - ], - onsubmit: function(event) { - + editor.windowManager.open({ + body: [ + { + items: [ + { + label: "Search term", + name: "searchterm", + onPostRender: function() { + this.getEl().value = "Hello there"; + }, + type: "textbox", + }, + { + html: ``, + 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"); } diff --git a/ccm-cms-tinymce/src/main/typescript.off/ccm-cms/ccm-cms-tinymce.ts b/ccm-cms-tinymce/src/main/typescript.off/ccm-cms/ccm-cms-tinymce.ts index a4a617398..1fdbc60ae 100644 --- a/ccm-cms-tinymce/src/main/typescript.off/ccm-cms/ccm-cms-tinymce.ts +++ b/ccm-cms-tinymce/src/main/typescript.off/ccm-cms/ccm-cms-tinymce.ts @@ -10,7 +10,7 @@ tinymce.PluginManager.add("ccm-cms-insertmedia", text: "Insert media", icon: false, onclick: function() { - openDialog(editor); + const dialog = openDialog(editor); } } );