PHP Classes

File: public/js/tinymce/src/plugins/image/src/main/js/core/FilterContent.js

Recommend this page to a friend!
  Classes of Abed Nego Ragil Putra   GoLavaCMS   public/js/tinymce/src/plugins/image/src/main/js/core/FilterContent.js   Download  
File: public/js/tinymce/src/plugins/image/src/main/js/core/FilterContent.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: 1,310 bytes
 

Contents

Class file image Download
/** * FilterContent.js * * Released under LGPL License. * Copyright (c) 1999-2017 Ephox Corp. All rights reserved * * License: http://www.tinymce.com/license * Contributing: http://www.tinymce.com/contributing */ define( 'tinymce.plugins.image.core.FilterContent', [ 'tinymce.core.util.Tools' ], function (Tools) { var hasImageClass = function (node) { var className = node.attr('class'); return className && /\bimage\b/.test(className); }; var toggleContentEditableState = function (state) { return function (nodes) { var i = nodes.length, node; var toggleContentEditable = function (node) { node.attr('contenteditable', state ? 'true' : null); }; while (i--) { node = nodes[i]; if (hasImageClass(node)) { node.attr('contenteditable', state ? 'false' : null); Tools.each(node.getAll('figcaption'), toggleContentEditable); } } }; }; var setup = function (editor) { editor.on('preInit', function () { editor.parser.addNodeFilter('figure', toggleContentEditableState(true)); editor.serializer.addNodeFilter('figure', toggleContentEditableState(false)); }); }; return { setup: setup }; } );