PHP Classes

File: public/js/tinymce/src/core/src/main/js/caret/CaretContainerInput.js

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

Contents

Class file image Download
/** * CaretContainerInput.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 */ /** * This module shows the invisble block that the caret is currently in when contents is added to that block. */ define( 'tinymce.core.caret.CaretContainerInput', [ 'ephox.katamari.api.Fun', 'ephox.sugar.api.node.Element', 'ephox.sugar.api.search.SelectorFind', 'tinymce.core.caret.CaretContainer' ], function (Fun, Element, SelectorFind, CaretContainer) { var findBlockCaretContainer = function (editor) { return SelectorFind.descendant(Element.fromDom(editor.getBody()), '*[data-mce-caret]').fold(Fun.constant(null), function (elm) { return elm.dom(); }); }; var removeIeControlRect = function (editor) { editor.selection.setRng(editor.selection.getRng()); }; var showBlockCaretContainer = function (editor, blockCaretContainer) { if (blockCaretContainer.hasAttribute('data-mce-caret')) { CaretContainer.showCaretContainerBlock(blockCaretContainer); removeIeControlRect(editor); editor.selection.scrollIntoView(blockCaretContainer); } }; var handleBlockContainer = function (editor, e) { var blockCaretContainer = findBlockCaretContainer(editor); if (!blockCaretContainer) { return; } if (e.type === 'compositionstart') { e.preventDefault(); e.stopPropagation(); showBlockCaretContainer(blockCaretContainer); return; } if (CaretContainer.hasContent(blockCaretContainer)) { showBlockCaretContainer(editor, blockCaretContainer); } }; var setup = function (editor) { editor.on('keyup compositionstart', Fun.curry(handleBlockContainer, editor)); }; return { setup: setup }; } );