-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplugin.js
More file actions
35 lines (29 loc) · 771 Bytes
/
plugin.js
File metadata and controls
35 lines (29 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* plugin.js
*
* Released under LGPL License.
* Copyright (c) 2015 SIRAP SAS All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
/*global tinymce:true */
tinymce.PluginManager.add('tabindent', function(editor) {
editor.on('keydown', function(e) {
// Check for tab but not ctrl/cmd+tab since it switches browser tabs
if (e.keyCode != 9 || tinymce.util.VK.metaKeyPressed(e)) {
return;
}
e.preventDefault();
/**
* @todo
* - configure indentation content with tinymce getParam()
*/
function indentSelection(){
editor.insertContent(' ');
}
if (editor.dom.getParent(editor.selection.getStart(), 'p')) {
indentSelection();
}
});
});