/** * Demo.js * * Released under LGPL License. * Copyright (c) 1999-2016 Ephox Corp. All rights reserved * * License: http://www.tinymce.com/license * Contributing: http://www.tinymce.com/contributing */ /*eslint no-console:0 */ define("tinymce/imagetoolsplugin/Demo", [ "tinymce/imagetoolsplugin/Plugin", "global!tinymce", "global!tinymce.dom.DomQuery", "global!console" ], function(Plugin, tinymce, $, console) { return function() { var imgSrc = '../../../../../../../tests/manual/img/dogleft.jpg'; $( '' ).appendTo('#ephox-ui'); tinymce.init({ //imagetools_cors_hosts: ["moxiecode.cachefly.net"], //imagetools_proxy: "proxy.php", //imagetools_api_key: '123', //images_upload_url: 'postAcceptor.php', //images_upload_base_path: 'base/path', //images_upload_credentials: true, selector: "textarea.tinymce", theme: "modern", plugins: [ "imagetools paste" ], add_unload_trigger: false, //images_replace_blob_uris: false, paste_data_images: true, image_caption: true, height: 600, toolbar1: "undo redo | styleselect | alignleft aligncenter alignright alignjustify | link image | media | emoticons", images_upload_handler: function(data, success, failure, progress) { console.log('blob upload [started]', data.id()); progress(0); setTimeout(function() { console.log('blob upload [ended]', data.id()); success(data.id() + '.png'); progress(100); }, 1000); } }); function send() { tinymce.activeEditor.uploadImages(function() { console.log('saving:', tinymce.activeEditor.getContent()); }); } function upload() { console.log('upload [started]'); tinymce.activeEditor.uploadImages(function(success) { console.log('upload [ended]', success); }); } function dump() { var content = tinymce.activeEditor.getContent(); $('#view').html(content); console.log(content); } $('').appendTo('#ephox-ui').on('click', send); $('').appendTo('#ephox-ui').on('click', upload); $('').appendTo('#ephox-ui').on('click', dump); }; });