PHP Classes

File: public/js/tinymce/src/core/src/main/js/keyboard/EnterKey.js

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

Contents

Class file image Download
/** * EnterKey.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.core.keyboard.EnterKey', [ 'tinymce.core.newline.InsertNewLine', 'tinymce.core.util.VK' ], function (InsertNewLine, VK) { var endTypingLevel = function (undoManager) { if (undoManager.typing) { undoManager.typing = false; undoManager.add(); } }; var handleEnterKeyEvent = function (editor, event) { if (event.isDefaultPrevented()) { return; } event.preventDefault(); endTypingLevel(editor.undoManager); editor.undoManager.transact(function () { if (editor.selection.isCollapsed() === false) { editor.execCommand('Delete'); } InsertNewLine.insert(editor, event); }); }; var setup = function (editor) { editor.on('keydown', function (event) { if (event.keyCode === VK.ENTER) { handleEnterKeyEvent(editor, event); } }); }; return { setup: setup }; } );