Created
May 15, 2018 09:08
-
-
Save keefyhub/2d559dc483038eb054f1d550f496ab1b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| editor.addButton('add_dummy_content', { | |
| title: 'Add dummy content', | |
| onclick: function () { | |
| editor.windowManager.open({ | |
| title: 'Add dummy content', | |
| body: [ | |
| { | |
| type: 'checkbox', | |
| name: 'title', | |
| text: 'Title' | |
| }, | |
| { | |
| type: 'checkbox', | |
| name: 'subtitle', | |
| text: 'Sub-title' | |
| }, | |
| { | |
| type: 'checkbox', | |
| name: 'paragraph', | |
| text: 'Paragraph' | |
| } | |
| ], | |
| onsubmit: function (e) { | |
| if (e.data.title === true) { | |
| // send_to_editor += 'Title'; | |
| $.ajax({ | |
| url: '//www.randomtext.me/api/lorem/h1/5-15', | |
| type: 'GET', | |
| crossDomain: true, | |
| dataType: 'JSON', | |
| success: function (data) { | |
| console.log(data); | |
| // send_to_editor = data.text_out; | |
| editor.insertContent(data.text_out); | |
| }, | |
| error: function (data) { | |
| console.log(data); | |
| } | |
| }); | |
| } | |
| if (e.data.subtitle === true) { | |
| // send_to_editor += 'Subtitle'; | |
| $.ajax({ | |
| url: '//www.randomtext.me/api/lorem/h2/5-15', | |
| type: 'GET', | |
| crossDomain: true, | |
| dataType: 'JSON', | |
| success: function (data) { | |
| console.log(data); | |
| // send_to_editor = data.text_out; | |
| editor.insertContent(data.text_out); | |
| }, | |
| error: function (data) { | |
| console.log(data); | |
| } | |
| }); | |
| } | |
| if (e.data.paragraph === true) { | |
| // send_to_editor += 'Paragraph'; | |
| $.ajax({ | |
| url: '//www.randomtext.me/api/lorem/p-5/15-30', | |
| type: 'GET', | |
| crossDomain: true, | |
| dataType: 'JSON', | |
| success: function (data) { | |
| console.log(data); | |
| // send_to_editor = data.text_out; | |
| editor.insertContent(data.text_out); | |
| }, | |
| error: function (data) { | |
| console.log(data); | |
| } | |
| }); | |
| } | |
| // editor.insertContent(send_to_editor + 'test'); | |
| } | |
| }); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment