PHP Classes

File: public/js/tinymce/src/plugins/image/src/main/js/ui/MainTab.js

Recommend this page to a friend!
  Classes of Abed Nego Ragil Putra   GoLavaCMS   public/js/tinymce/src/plugins/image/src/main/js/ui/MainTab.js   Download  
File: public/js/tinymce/src/plugins/image/src/main/js/ui/MainTab.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: GoLavaCMS
Publish content on Web pages with SEO support
Author: By
Last change:
Date: 6 years ago
Size: 3,535 bytes
 

Contents

Class file image Download
define( 'tinymce.plugins.image.ui.MainTab', [ 'tinymce.core.util.Tools', 'tinymce.plugins.image.api.Settings', 'tinymce.plugins.image.core.Utils', 'tinymce.plugins.image.ui.SizeManager' ], function (Tools, Settings, Utils, SizeManager) { var onSrcChange = function (evt, editor) { var srcURL, prependURL, absoluteURLPattern, meta = evt.meta || {}; var control = evt.control; var rootControl = control.rootControl; var imageListCtrl = rootControl.find('#image-list')[0]; if (imageListCtrl) { imageListCtrl.value(editor.convertURL(control.value(), 'src')); } Tools.each(meta, function (value, key) { rootControl.find('#' + key).value(value); }); if (!meta.width && !meta.height) { srcURL = editor.convertURL(control.value(), 'src'); // Pattern test the src url and make sure we haven't already prepended the url prependURL = Settings.getPrependUrl(editor); absoluteURLPattern = new RegExp('^(?:[a-z]+:)?//', 'i'); if (prependURL && !absoluteURLPattern.test(srcURL) && srcURL.substring(0, prependURL.length) !== prependURL) { srcURL = prependURL + srcURL; } control.value(srcURL); Utils.getImageSize(editor.documentBaseURI.toAbsolute(control.value()), function (data) { if (data.width && data.height && Settings.hasDimensions(editor)) { rootControl.find('#width').value(data.width); rootControl.find('#height').value(data.height); SizeManager.updateSize(rootControl); } }); } }; var onBeforeCall = function (evt) { evt.meta = evt.control.rootControl.toJSON(); }; var getGeneralItems = function (editor, imageListCtrl) { var generalFormItems = [ { name: 'src', type: 'filepicker', filetype: 'image', label: 'Source', autofocus: true, onchange: function (evt) { onSrcChange(evt, editor); }, onbeforecall: onBeforeCall }, imageListCtrl ]; if (Settings.hasDescription(editor)) { generalFormItems.push({ name: 'alt', type: 'textbox', label: 'Image description' }); } if (Settings.hasImageTitle(editor)) { generalFormItems.push({ name: 'title', type: 'textbox', label: 'Image Title' }); } if (Settings.hasDimensions(editor)) { generalFormItems.push( SizeManager.createUi() ); } if (Settings.getClassList(editor)) { generalFormItems.push({ name: 'class', type: 'listbox', label: 'Class', values: Utils.buildListItems( Settings.getClassList(editor), function (item) { if (item.value) { item.textStyle = function () { return editor.formatter.getCssText({ inline: 'img', classes: [item.value] }); }; } } ) }); } if (Settings.hasImageCaption(editor)) { generalFormItems.push({ name: 'caption', type: 'checkbox', label: 'Caption' }); } return generalFormItems; }; var makeTab = function (editor, imageListCtrl) { return { title: 'General', type: 'form', items: getGeneralItems(editor, imageListCtrl) }; }; return { makeTab: makeTab, getGeneralItems: getGeneralItems }; } );