From 6854cb3f4d8219cf1829e32122eb2502a916eae9 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 1 Feb 2020 09:05:48 +0100 Subject: initial checkin --- .../samples/plugins/dialog/assets/my_dialog.js | 48 ++++++ js/ckeditor/samples/plugins/dialog/dialog.html | 187 +++++++++++++++++++++ 2 files changed, 235 insertions(+) create mode 100644 js/ckeditor/samples/plugins/dialog/assets/my_dialog.js create mode 100644 js/ckeditor/samples/plugins/dialog/dialog.html (limited to 'js/ckeditor/samples/plugins/dialog') diff --git a/js/ckeditor/samples/plugins/dialog/assets/my_dialog.js b/js/ckeditor/samples/plugins/dialog/assets/my_dialog.js new file mode 100644 index 0000000..8a9ea63 --- /dev/null +++ b/js/ckeditor/samples/plugins/dialog/assets/my_dialog.js @@ -0,0 +1,48 @@ +/** + * Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.md or http://ckeditor.com/license + */ + +CKEDITOR.dialog.add( 'myDialog', function() { + return { + title: 'My Dialog', + minWidth: 400, + minHeight: 200, + contents: [ + { + id: 'tab1', + label: 'First Tab', + title: 'First Tab', + elements: [ + { + id: 'input1', + type: 'text', + label: 'Text Field' + }, + { + id: 'select1', + type: 'select', + label: 'Select Field', + items: [ + [ 'option1', 'value1' ], + [ 'option2', 'value2' ] + ] + } + ] + }, + { + id: 'tab2', + label: 'Second Tab', + title: 'Second Tab', + elements: [ + { + id: 'button1', + type: 'button', + label: 'Button Field' + } + ] + } + ] + }; +} ); + diff --git a/js/ckeditor/samples/plugins/dialog/dialog.html b/js/ckeditor/samples/plugins/dialog/dialog.html new file mode 100644 index 0000000..a85c566 --- /dev/null +++ b/js/ckeditor/samples/plugins/dialog/dialog.html @@ -0,0 +1,187 @@ + + + + + + Using API to Customize Dialog Windows — CKEditor Sample + + + + + + + + + +

+ CKEditor Samples » Using CKEditor Dialog API +

+
+

+ This sample shows how to use the + CKEditor Dialog API + to customize CKEditor dialog windows without changing the original editor code. + The following customizations are being done in the example below: +

+

+ For details on how to create this setup check the source code of this sample page. +

+
+

A custom dialog is added to the editors using the pluginsLoaded event, from an external dialog definition file:

+
    +
  1. Creating a custom dialog window – "My Dialog" dialog window opened with the "My Dialog" toolbar button.
  2. +
  3. Creating a custom button – Add button to open the dialog with "My Dialog" toolbar button.
  4. +
+ + +

The below editor modify the dialog definition of the above added dialog using the dialogDefinition event:

+
    +
  1. Adding dialog tab – Add new tab "My Tab" to dialog window.
  2. +
  3. Removing a dialog window tab – Remove "Second Tab" page from the dialog window.
  4. +
  5. Adding dialog window fields – Add "My Custom Field" to the dialog window.
  6. +
  7. Removing dialog window field – Remove "Select Field" selection field from the dialog window.
  8. +
  9. Setting default values for dialog window fields – Set default value of "Text Field" text field.
  10. +
  11. Setup initial focus for dialog window – Put initial focus on "My Custom Field" text field.
  12. +
+ + + + + -- cgit v1.2.3-70-g09d2