id
int32 0
58k
| repo
stringlengths 5
67
| path
stringlengths 4
116
| func_name
stringlengths 0
58
| original_string
stringlengths 52
373k
| language
stringclasses 1
value | code
stringlengths 52
373k
| code_tokens
list | docstring
stringlengths 4
11.8k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 86
226
|
---|---|---|---|---|---|---|---|---|---|---|---|
48,200 | sadiqhabib/tinymce-dist | tinymce.full.js | createCaretContainer | function createCaretContainer(fill) {
var caretContainer = dom.create('span', { id: caretContainerId, 'data-mce-bogus': true, style: debug ? 'color:red' : '' });
if (fill) {
caretContainer.appendChild(ed.getDoc().createTextNode(INVISIBLE_CHAR));
}
return caretContainer;
} | javascript | function createCaretContainer(fill) {
var caretContainer = dom.create('span', { id: caretContainerId, 'data-mce-bogus': true, style: debug ? 'color:red' : '' });
if (fill) {
caretContainer.appendChild(ed.getDoc().createTextNode(INVISIBLE_CHAR));
}
return caretContainer;
} | [
"function",
"createCaretContainer",
"(",
"fill",
")",
"{",
"var",
"caretContainer",
"=",
"dom",
".",
"create",
"(",
"'span'",
",",
"{",
"id",
":",
"caretContainerId",
",",
"'data-mce-bogus'",
":",
"true",
",",
"style",
":",
"debug",
"?",
"'color:red'",
":",
"''",
"}",
")",
";",
"if",
"(",
"fill",
")",
"{",
"caretContainer",
".",
"appendChild",
"(",
"ed",
".",
"getDoc",
"(",
")",
".",
"createTextNode",
"(",
"INVISIBLE_CHAR",
")",
")",
";",
"}",
"return",
"caretContainer",
";",
"}"
] | Creates a caret container bogus element | [
"Creates",
"a",
"caret",
"container",
"bogus",
"element"
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L21325-L21333 |
48,201 | sadiqhabib/tinymce-dist | tinymce.full.js | getParentCaretContainer | function getParentCaretContainer(node) {
while (node) {
if (node.id === caretContainerId) {
return node;
}
node = node.parentNode;
}
} | javascript | function getParentCaretContainer(node) {
while (node) {
if (node.id === caretContainerId) {
return node;
}
node = node.parentNode;
}
} | [
"function",
"getParentCaretContainer",
"(",
"node",
")",
"{",
"while",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"id",
"===",
"caretContainerId",
")",
"{",
"return",
"node",
";",
"}",
"node",
"=",
"node",
".",
"parentNode",
";",
"}",
"}"
] | Returns any parent caret container element | [
"Returns",
"any",
"parent",
"caret",
"container",
"element"
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L21353-L21361 |
48,202 | sadiqhabib/tinymce-dist | tinymce.full.js | findFirstTextNode | function findFirstTextNode(node) {
var walker;
if (node) {
walker = new TreeWalker(node, node);
for (node = walker.current(); node; node = walker.next()) {
if (node.nodeType === 3) {
return node;
}
}
}
} | javascript | function findFirstTextNode(node) {
var walker;
if (node) {
walker = new TreeWalker(node, node);
for (node = walker.current(); node; node = walker.next()) {
if (node.nodeType === 3) {
return node;
}
}
}
} | [
"function",
"findFirstTextNode",
"(",
"node",
")",
"{",
"var",
"walker",
";",
"if",
"(",
"node",
")",
"{",
"walker",
"=",
"new",
"TreeWalker",
"(",
"node",
",",
"node",
")",
";",
"for",
"(",
"node",
"=",
"walker",
".",
"current",
"(",
")",
";",
"node",
";",
"node",
"=",
"walker",
".",
"next",
"(",
")",
")",
"{",
"if",
"(",
"node",
".",
"nodeType",
"===",
"3",
")",
"{",
"return",
"node",
";",
"}",
"}",
"}",
"}"
] | Finds the first text node in the specified node | [
"Finds",
"the",
"first",
"text",
"node",
"in",
"the",
"specified",
"node"
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L21364-L21376 |
48,203 | sadiqhabib/tinymce-dist | tinymce.full.js | applyCaretFormat | function applyCaretFormat() {
var rng, caretContainer, textNode, offset, bookmark, container, text;
rng = selection.getRng(true);
offset = rng.startOffset;
container = rng.startContainer;
text = container.nodeValue;
caretContainer = getParentCaretContainer(selection.getStart());
if (caretContainer) {
textNode = findFirstTextNode(caretContainer);
}
// Expand to word if caret is in the middle of a text node and the char before/after is a alpha numeric character
var wordcharRegex = /[^\s\u00a0\u00ad\u200b\ufeff]/;
if (text && offset > 0 && offset < text.length &&
wordcharRegex.test(text.charAt(offset)) && wordcharRegex.test(text.charAt(offset - 1))) {
// Get bookmark of caret position
bookmark = selection.getBookmark();
// Collapse bookmark range (WebKit)
rng.collapse(true);
// Expand the range to the closest word and split it at those points
rng = expandRng(rng, get(name));
rng = rangeUtils.split(rng);
// Apply the format to the range
apply(name, vars, rng);
// Move selection back to caret position
selection.moveToBookmark(bookmark);
} else {
if (!caretContainer || textNode.nodeValue !== INVISIBLE_CHAR) {
caretContainer = createCaretContainer(true);
textNode = caretContainer.firstChild;
rng.insertNode(caretContainer);
offset = 1;
apply(name, vars, caretContainer);
} else {
apply(name, vars, caretContainer);
}
// Move selection to text node
selection.setCursorLocation(textNode, offset);
}
} | javascript | function applyCaretFormat() {
var rng, caretContainer, textNode, offset, bookmark, container, text;
rng = selection.getRng(true);
offset = rng.startOffset;
container = rng.startContainer;
text = container.nodeValue;
caretContainer = getParentCaretContainer(selection.getStart());
if (caretContainer) {
textNode = findFirstTextNode(caretContainer);
}
// Expand to word if caret is in the middle of a text node and the char before/after is a alpha numeric character
var wordcharRegex = /[^\s\u00a0\u00ad\u200b\ufeff]/;
if (text && offset > 0 && offset < text.length &&
wordcharRegex.test(text.charAt(offset)) && wordcharRegex.test(text.charAt(offset - 1))) {
// Get bookmark of caret position
bookmark = selection.getBookmark();
// Collapse bookmark range (WebKit)
rng.collapse(true);
// Expand the range to the closest word and split it at those points
rng = expandRng(rng, get(name));
rng = rangeUtils.split(rng);
// Apply the format to the range
apply(name, vars, rng);
// Move selection back to caret position
selection.moveToBookmark(bookmark);
} else {
if (!caretContainer || textNode.nodeValue !== INVISIBLE_CHAR) {
caretContainer = createCaretContainer(true);
textNode = caretContainer.firstChild;
rng.insertNode(caretContainer);
offset = 1;
apply(name, vars, caretContainer);
} else {
apply(name, vars, caretContainer);
}
// Move selection to text node
selection.setCursorLocation(textNode, offset);
}
} | [
"function",
"applyCaretFormat",
"(",
")",
"{",
"var",
"rng",
",",
"caretContainer",
",",
"textNode",
",",
"offset",
",",
"bookmark",
",",
"container",
",",
"text",
";",
"rng",
"=",
"selection",
".",
"getRng",
"(",
"true",
")",
";",
"offset",
"=",
"rng",
".",
"startOffset",
";",
"container",
"=",
"rng",
".",
"startContainer",
";",
"text",
"=",
"container",
".",
"nodeValue",
";",
"caretContainer",
"=",
"getParentCaretContainer",
"(",
"selection",
".",
"getStart",
"(",
")",
")",
";",
"if",
"(",
"caretContainer",
")",
"{",
"textNode",
"=",
"findFirstTextNode",
"(",
"caretContainer",
")",
";",
"}",
"// Expand to word if caret is in the middle of a text node and the char before/after is a alpha numeric character",
"var",
"wordcharRegex",
"=",
"/",
"[^\\s\\u00a0\\u00ad\\u200b\\ufeff]",
"/",
";",
"if",
"(",
"text",
"&&",
"offset",
">",
"0",
"&&",
"offset",
"<",
"text",
".",
"length",
"&&",
"wordcharRegex",
".",
"test",
"(",
"text",
".",
"charAt",
"(",
"offset",
")",
")",
"&&",
"wordcharRegex",
".",
"test",
"(",
"text",
".",
"charAt",
"(",
"offset",
"-",
"1",
")",
")",
")",
"{",
"// Get bookmark of caret position",
"bookmark",
"=",
"selection",
".",
"getBookmark",
"(",
")",
";",
"// Collapse bookmark range (WebKit)",
"rng",
".",
"collapse",
"(",
"true",
")",
";",
"// Expand the range to the closest word and split it at those points",
"rng",
"=",
"expandRng",
"(",
"rng",
",",
"get",
"(",
"name",
")",
")",
";",
"rng",
"=",
"rangeUtils",
".",
"split",
"(",
"rng",
")",
";",
"// Apply the format to the range",
"apply",
"(",
"name",
",",
"vars",
",",
"rng",
")",
";",
"// Move selection back to caret position",
"selection",
".",
"moveToBookmark",
"(",
"bookmark",
")",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"caretContainer",
"||",
"textNode",
".",
"nodeValue",
"!==",
"INVISIBLE_CHAR",
")",
"{",
"caretContainer",
"=",
"createCaretContainer",
"(",
"true",
")",
";",
"textNode",
"=",
"caretContainer",
".",
"firstChild",
";",
"rng",
".",
"insertNode",
"(",
"caretContainer",
")",
";",
"offset",
"=",
"1",
";",
"apply",
"(",
"name",
",",
"vars",
",",
"caretContainer",
")",
";",
"}",
"else",
"{",
"apply",
"(",
"name",
",",
"vars",
",",
"caretContainer",
")",
";",
"}",
"// Move selection to text node",
"selection",
".",
"setCursorLocation",
"(",
"textNode",
",",
"offset",
")",
";",
"}",
"}"
] | Applies formatting to the caret position | [
"Applies",
"formatting",
"to",
"the",
"caret",
"position"
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L21424-L21472 |
48,204 | sadiqhabib/tinymce-dist | tinymce.full.js | moveStart | function moveStart(rng) {
var container = rng.startContainer,
offset = rng.startOffset, isAtEndOfText,
walker, node, nodes, tmpNode;
if (rng.startContainer == rng.endContainer) {
if (isInlineBlock(rng.startContainer.childNodes[rng.startOffset])) {
return;
}
}
// Convert text node into index if possible
if (container.nodeType == 3 && offset >= container.nodeValue.length) {
// Get the parent container location and walk from there
offset = nodeIndex(container);
container = container.parentNode;
isAtEndOfText = true;
}
// Move startContainer/startOffset in to a suitable node
if (container.nodeType == 1) {
nodes = container.childNodes;
container = nodes[Math.min(offset, nodes.length - 1)];
walker = new TreeWalker(container, dom.getParent(container, dom.isBlock));
// If offset is at end of the parent node walk to the next one
if (offset > nodes.length - 1 || isAtEndOfText) {
walker.next();
}
for (node = walker.current(); node; node = walker.next()) {
if (node.nodeType == 3 && !isWhiteSpaceNode(node)) {
// IE has a "neat" feature where it moves the start node into the closest element
// we can avoid this by inserting an element before it and then remove it after we set the selection
tmpNode = dom.create('a', { 'data-mce-bogus': 'all' }, INVISIBLE_CHAR);
node.parentNode.insertBefore(tmpNode, node);
// Set selection and remove tmpNode
rng.setStart(node, 0);
selection.setRng(rng);
dom.remove(tmpNode);
return;
}
}
}
} | javascript | function moveStart(rng) {
var container = rng.startContainer,
offset = rng.startOffset, isAtEndOfText,
walker, node, nodes, tmpNode;
if (rng.startContainer == rng.endContainer) {
if (isInlineBlock(rng.startContainer.childNodes[rng.startOffset])) {
return;
}
}
// Convert text node into index if possible
if (container.nodeType == 3 && offset >= container.nodeValue.length) {
// Get the parent container location and walk from there
offset = nodeIndex(container);
container = container.parentNode;
isAtEndOfText = true;
}
// Move startContainer/startOffset in to a suitable node
if (container.nodeType == 1) {
nodes = container.childNodes;
container = nodes[Math.min(offset, nodes.length - 1)];
walker = new TreeWalker(container, dom.getParent(container, dom.isBlock));
// If offset is at end of the parent node walk to the next one
if (offset > nodes.length - 1 || isAtEndOfText) {
walker.next();
}
for (node = walker.current(); node; node = walker.next()) {
if (node.nodeType == 3 && !isWhiteSpaceNode(node)) {
// IE has a "neat" feature where it moves the start node into the closest element
// we can avoid this by inserting an element before it and then remove it after we set the selection
tmpNode = dom.create('a', { 'data-mce-bogus': 'all' }, INVISIBLE_CHAR);
node.parentNode.insertBefore(tmpNode, node);
// Set selection and remove tmpNode
rng.setStart(node, 0);
selection.setRng(rng);
dom.remove(tmpNode);
return;
}
}
}
} | [
"function",
"moveStart",
"(",
"rng",
")",
"{",
"var",
"container",
"=",
"rng",
".",
"startContainer",
",",
"offset",
"=",
"rng",
".",
"startOffset",
",",
"isAtEndOfText",
",",
"walker",
",",
"node",
",",
"nodes",
",",
"tmpNode",
";",
"if",
"(",
"rng",
".",
"startContainer",
"==",
"rng",
".",
"endContainer",
")",
"{",
"if",
"(",
"isInlineBlock",
"(",
"rng",
".",
"startContainer",
".",
"childNodes",
"[",
"rng",
".",
"startOffset",
"]",
")",
")",
"{",
"return",
";",
"}",
"}",
"// Convert text node into index if possible",
"if",
"(",
"container",
".",
"nodeType",
"==",
"3",
"&&",
"offset",
">=",
"container",
".",
"nodeValue",
".",
"length",
")",
"{",
"// Get the parent container location and walk from there",
"offset",
"=",
"nodeIndex",
"(",
"container",
")",
";",
"container",
"=",
"container",
".",
"parentNode",
";",
"isAtEndOfText",
"=",
"true",
";",
"}",
"// Move startContainer/startOffset in to a suitable node",
"if",
"(",
"container",
".",
"nodeType",
"==",
"1",
")",
"{",
"nodes",
"=",
"container",
".",
"childNodes",
";",
"container",
"=",
"nodes",
"[",
"Math",
".",
"min",
"(",
"offset",
",",
"nodes",
".",
"length",
"-",
"1",
")",
"]",
";",
"walker",
"=",
"new",
"TreeWalker",
"(",
"container",
",",
"dom",
".",
"getParent",
"(",
"container",
",",
"dom",
".",
"isBlock",
")",
")",
";",
"// If offset is at end of the parent node walk to the next one",
"if",
"(",
"offset",
">",
"nodes",
".",
"length",
"-",
"1",
"||",
"isAtEndOfText",
")",
"{",
"walker",
".",
"next",
"(",
")",
";",
"}",
"for",
"(",
"node",
"=",
"walker",
".",
"current",
"(",
")",
";",
"node",
";",
"node",
"=",
"walker",
".",
"next",
"(",
")",
")",
"{",
"if",
"(",
"node",
".",
"nodeType",
"==",
"3",
"&&",
"!",
"isWhiteSpaceNode",
"(",
"node",
")",
")",
"{",
"// IE has a \"neat\" feature where it moves the start node into the closest element",
"// we can avoid this by inserting an element before it and then remove it after we set the selection",
"tmpNode",
"=",
"dom",
".",
"create",
"(",
"'a'",
",",
"{",
"'data-mce-bogus'",
":",
"'all'",
"}",
",",
"INVISIBLE_CHAR",
")",
";",
"node",
".",
"parentNode",
".",
"insertBefore",
"(",
"tmpNode",
",",
"node",
")",
";",
"// Set selection and remove tmpNode",
"rng",
".",
"setStart",
"(",
"node",
",",
"0",
")",
";",
"selection",
".",
"setRng",
"(",
"rng",
")",
";",
"dom",
".",
"remove",
"(",
"tmpNode",
")",
";",
"return",
";",
"}",
"}",
"}",
"}"
] | Moves the start to the first suitable text node. | [
"Moves",
"the",
"start",
"to",
"the",
"first",
"suitable",
"text",
"node",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L21627-L21673 |
48,205 | sadiqhabib/tinymce-dist | tinymce.full.js | function () {
var level;
if (index < data.length - 1) {
level = data[++index];
Levels.applyToEditor(editor, level, false);
setDirty(true);
editor.fire('redo', { level: level });
}
return level;
} | javascript | function () {
var level;
if (index < data.length - 1) {
level = data[++index];
Levels.applyToEditor(editor, level, false);
setDirty(true);
editor.fire('redo', { level: level });
}
return level;
} | [
"function",
"(",
")",
"{",
"var",
"level",
";",
"if",
"(",
"index",
"<",
"data",
".",
"length",
"-",
"1",
")",
"{",
"level",
"=",
"data",
"[",
"++",
"index",
"]",
";",
"Levels",
".",
"applyToEditor",
"(",
"editor",
",",
"level",
",",
"false",
")",
";",
"setDirty",
"(",
"true",
")",
";",
"editor",
".",
"fire",
"(",
"'redo'",
",",
"{",
"level",
":",
"level",
"}",
")",
";",
"}",
"return",
"level",
";",
"}"
] | Redoes the last action.
@method redo
@return {Object} Redo level or null if no redo was performed. | [
"Redoes",
"the",
"last",
"action",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L22297-L22308 |
|
48,206 | sadiqhabib/tinymce-dist | tinymce.full.js | function () {
data = [];
index = 0;
self.typing = false;
self.data = data;
editor.fire('ClearUndos');
} | javascript | function () {
data = [];
index = 0;
self.typing = false;
self.data = data;
editor.fire('ClearUndos');
} | [
"function",
"(",
")",
"{",
"data",
"=",
"[",
"]",
";",
"index",
"=",
"0",
";",
"self",
".",
"typing",
"=",
"false",
";",
"self",
".",
"data",
"=",
"data",
";",
"editor",
".",
"fire",
"(",
"'ClearUndos'",
")",
";",
"}"
] | Removes all undo levels.
@method clear | [
"Removes",
"all",
"undo",
"levels",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L22315-L22321 |
|
48,207 | sadiqhabib/tinymce-dist | tinymce.full.js | function (callback1, callback2) {
var lastLevel, bookmark;
if (self.transact(callback1)) {
bookmark = data[index].bookmark;
lastLevel = data[index - 1];
Levels.applyToEditor(editor, lastLevel, true);
if (self.transact(callback2)) {
data[index - 1].beforeBookmark = bookmark;
}
}
} | javascript | function (callback1, callback2) {
var lastLevel, bookmark;
if (self.transact(callback1)) {
bookmark = data[index].bookmark;
lastLevel = data[index - 1];
Levels.applyToEditor(editor, lastLevel, true);
if (self.transact(callback2)) {
data[index - 1].beforeBookmark = bookmark;
}
}
} | [
"function",
"(",
"callback1",
",",
"callback2",
")",
"{",
"var",
"lastLevel",
",",
"bookmark",
";",
"if",
"(",
"self",
".",
"transact",
"(",
"callback1",
")",
")",
"{",
"bookmark",
"=",
"data",
"[",
"index",
"]",
".",
"bookmark",
";",
"lastLevel",
"=",
"data",
"[",
"index",
"-",
"1",
"]",
";",
"Levels",
".",
"applyToEditor",
"(",
"editor",
",",
"lastLevel",
",",
"true",
")",
";",
"if",
"(",
"self",
".",
"transact",
"(",
"callback2",
")",
")",
"{",
"data",
"[",
"index",
"-",
"1",
"]",
".",
"beforeBookmark",
"=",
"bookmark",
";",
"}",
"}",
"}"
] | Adds an extra "hidden" undo level by first applying the first mutation and store that to the undo stack
then roll back that change and do the second mutation on top of the stack. This will produce an extra
undo level that the user doesn't see until they undo.
@method extra
@param {function} callback1 Function that does mutation but gets stored as a "hidden" extra undo level.
@param {function} callback2 Function that does mutation but gets displayed to the user. | [
"Adds",
"an",
"extra",
"hidden",
"undo",
"level",
"by",
"first",
"applying",
"the",
"first",
"mutation",
"and",
"store",
"that",
"to",
"the",
"undo",
"stack",
"then",
"roll",
"back",
"that",
"change",
"and",
"do",
"the",
"second",
"mutation",
"on",
"top",
"of",
"the",
"stack",
".",
"This",
"will",
"produce",
"an",
"extra",
"undo",
"level",
"that",
"the",
"user",
"doesn",
"t",
"see",
"until",
"they",
"undo",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L22377-L22389 |
|
48,208 | sadiqhabib/tinymce-dist | tinymce.full.js | execCommand | function execCommand(command, ui, value, args) {
var func, customCommand, state = 0;
if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint)$/.test(command) && (!args || !args.skip_focus)) {
editor.focus();
}
args = editor.fire('BeforeExecCommand', { command: command, ui: ui, value: value });
if (args.isDefaultPrevented()) {
return false;
}
customCommand = command.toLowerCase();
if ((func = commands.exec[customCommand])) {
func(customCommand, ui, value);
editor.fire('ExecCommand', { command: command, ui: ui, value: value });
return true;
}
// Plugin commands
each(editor.plugins, function (p) {
if (p.execCommand && p.execCommand(command, ui, value)) {
editor.fire('ExecCommand', { command: command, ui: ui, value: value });
state = true;
return false;
}
});
if (state) {
return state;
}
// Theme commands
if (editor.theme && editor.theme.execCommand && editor.theme.execCommand(command, ui, value)) {
editor.fire('ExecCommand', { command: command, ui: ui, value: value });
return true;
}
// Browser commands
try {
state = editor.getDoc().execCommand(command, ui, value);
} catch (ex) {
// Ignore old IE errors
}
if (state) {
editor.fire('ExecCommand', { command: command, ui: ui, value: value });
return true;
}
return false;
} | javascript | function execCommand(command, ui, value, args) {
var func, customCommand, state = 0;
if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint)$/.test(command) && (!args || !args.skip_focus)) {
editor.focus();
}
args = editor.fire('BeforeExecCommand', { command: command, ui: ui, value: value });
if (args.isDefaultPrevented()) {
return false;
}
customCommand = command.toLowerCase();
if ((func = commands.exec[customCommand])) {
func(customCommand, ui, value);
editor.fire('ExecCommand', { command: command, ui: ui, value: value });
return true;
}
// Plugin commands
each(editor.plugins, function (p) {
if (p.execCommand && p.execCommand(command, ui, value)) {
editor.fire('ExecCommand', { command: command, ui: ui, value: value });
state = true;
return false;
}
});
if (state) {
return state;
}
// Theme commands
if (editor.theme && editor.theme.execCommand && editor.theme.execCommand(command, ui, value)) {
editor.fire('ExecCommand', { command: command, ui: ui, value: value });
return true;
}
// Browser commands
try {
state = editor.getDoc().execCommand(command, ui, value);
} catch (ex) {
// Ignore old IE errors
}
if (state) {
editor.fire('ExecCommand', { command: command, ui: ui, value: value });
return true;
}
return false;
} | [
"function",
"execCommand",
"(",
"command",
",",
"ui",
",",
"value",
",",
"args",
")",
"{",
"var",
"func",
",",
"customCommand",
",",
"state",
"=",
"0",
";",
"if",
"(",
"!",
"/",
"^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint)$",
"/",
".",
"test",
"(",
"command",
")",
"&&",
"(",
"!",
"args",
"||",
"!",
"args",
".",
"skip_focus",
")",
")",
"{",
"editor",
".",
"focus",
"(",
")",
";",
"}",
"args",
"=",
"editor",
".",
"fire",
"(",
"'BeforeExecCommand'",
",",
"{",
"command",
":",
"command",
",",
"ui",
":",
"ui",
",",
"value",
":",
"value",
"}",
")",
";",
"if",
"(",
"args",
".",
"isDefaultPrevented",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"customCommand",
"=",
"command",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
"(",
"func",
"=",
"commands",
".",
"exec",
"[",
"customCommand",
"]",
")",
")",
"{",
"func",
"(",
"customCommand",
",",
"ui",
",",
"value",
")",
";",
"editor",
".",
"fire",
"(",
"'ExecCommand'",
",",
"{",
"command",
":",
"command",
",",
"ui",
":",
"ui",
",",
"value",
":",
"value",
"}",
")",
";",
"return",
"true",
";",
"}",
"// Plugin commands",
"each",
"(",
"editor",
".",
"plugins",
",",
"function",
"(",
"p",
")",
"{",
"if",
"(",
"p",
".",
"execCommand",
"&&",
"p",
".",
"execCommand",
"(",
"command",
",",
"ui",
",",
"value",
")",
")",
"{",
"editor",
".",
"fire",
"(",
"'ExecCommand'",
",",
"{",
"command",
":",
"command",
",",
"ui",
":",
"ui",
",",
"value",
":",
"value",
"}",
")",
";",
"state",
"=",
"true",
";",
"return",
"false",
";",
"}",
"}",
")",
";",
"if",
"(",
"state",
")",
"{",
"return",
"state",
";",
"}",
"// Theme commands",
"if",
"(",
"editor",
".",
"theme",
"&&",
"editor",
".",
"theme",
".",
"execCommand",
"&&",
"editor",
".",
"theme",
".",
"execCommand",
"(",
"command",
",",
"ui",
",",
"value",
")",
")",
"{",
"editor",
".",
"fire",
"(",
"'ExecCommand'",
",",
"{",
"command",
":",
"command",
",",
"ui",
":",
"ui",
",",
"value",
":",
"value",
"}",
")",
";",
"return",
"true",
";",
"}",
"// Browser commands",
"try",
"{",
"state",
"=",
"editor",
".",
"getDoc",
"(",
")",
".",
"execCommand",
"(",
"command",
",",
"ui",
",",
"value",
")",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"// Ignore old IE errors",
"}",
"if",
"(",
"state",
")",
"{",
"editor",
".",
"fire",
"(",
"'ExecCommand'",
",",
"{",
"command",
":",
"command",
",",
"ui",
":",
"ui",
",",
"value",
":",
"value",
"}",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Executes the specified command.
@method execCommand
@param {String} command Command to execute.
@param {Boolean} ui Optional user interface state.
@param {Object} value Optional value for command.
@param {Object} args Optional extra arguments to the execCommand.
@return {Boolean} true/false if the command was found or not. | [
"Executes",
"the",
"specified",
"command",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L23593-L23644 |
48,209 | sadiqhabib/tinymce-dist | tinymce.full.js | queryCommandState | function queryCommandState(command) {
var func;
// Is hidden then return undefined
if (editor.quirks.isHidden()) {
return;
}
command = command.toLowerCase();
if ((func = commands.state[command])) {
return func(command);
}
// Browser commands
try {
return editor.getDoc().queryCommandState(command);
} catch (ex) {
// Fails sometimes see bug: 1896577
}
return false;
} | javascript | function queryCommandState(command) {
var func;
// Is hidden then return undefined
if (editor.quirks.isHidden()) {
return;
}
command = command.toLowerCase();
if ((func = commands.state[command])) {
return func(command);
}
// Browser commands
try {
return editor.getDoc().queryCommandState(command);
} catch (ex) {
// Fails sometimes see bug: 1896577
}
return false;
} | [
"function",
"queryCommandState",
"(",
"command",
")",
"{",
"var",
"func",
";",
"// Is hidden then return undefined",
"if",
"(",
"editor",
".",
"quirks",
".",
"isHidden",
"(",
")",
")",
"{",
"return",
";",
"}",
"command",
"=",
"command",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
"(",
"func",
"=",
"commands",
".",
"state",
"[",
"command",
"]",
")",
")",
"{",
"return",
"func",
"(",
"command",
")",
";",
"}",
"// Browser commands",
"try",
"{",
"return",
"editor",
".",
"getDoc",
"(",
")",
".",
"queryCommandState",
"(",
"command",
")",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"// Fails sometimes see bug: 1896577",
"}",
"return",
"false",
";",
"}"
] | Queries the current state for a command for example if the current selection is "bold".
@method queryCommandState
@param {String} command Command to check the state of.
@return {Boolean/Number} true/false if the selected contents is bold or not, -1 if it's not found. | [
"Queries",
"the",
"current",
"state",
"for",
"a",
"command",
"for",
"example",
"if",
"the",
"current",
"selection",
"is",
"bold",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L23653-L23674 |
48,210 | sadiqhabib/tinymce-dist | tinymce.full.js | function () {
if (selection.isCollapsed()) {
var elm = editor.dom.getParent(editor.selection.getStart(), 'a');
if (elm) {
editor.dom.remove(elm, true);
}
return;
}
formatter.remove("link");
} | javascript | function () {
if (selection.isCollapsed()) {
var elm = editor.dom.getParent(editor.selection.getStart(), 'a');
if (elm) {
editor.dom.remove(elm, true);
}
return;
}
formatter.remove("link");
} | [
"function",
"(",
")",
"{",
"if",
"(",
"selection",
".",
"isCollapsed",
"(",
")",
")",
"{",
"var",
"elm",
"=",
"editor",
".",
"dom",
".",
"getParent",
"(",
"editor",
".",
"selection",
".",
"getStart",
"(",
")",
",",
"'a'",
")",
";",
"if",
"(",
"elm",
")",
"{",
"editor",
".",
"dom",
".",
"remove",
"(",
"elm",
",",
"true",
")",
";",
"}",
"return",
";",
"}",
"formatter",
".",
"remove",
"(",
"\"link\"",
")",
";",
"}"
] | Override unlink command | [
"Override",
"unlink",
"command"
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L23857-L23868 |
|
48,211 | sadiqhabib/tinymce-dist | tinymce.full.js | function (command) {
var align = command.substring(7);
if (align == 'full') {
align = 'justify';
}
// Remove all other alignments first
each('left,center,right,justify'.split(','), function (name) {
if (align != name) {
formatter.remove('align' + name);
}
});
if (align != 'none') {
toggleFormat('align' + align);
}
} | javascript | function (command) {
var align = command.substring(7);
if (align == 'full') {
align = 'justify';
}
// Remove all other alignments first
each('left,center,right,justify'.split(','), function (name) {
if (align != name) {
formatter.remove('align' + name);
}
});
if (align != 'none') {
toggleFormat('align' + align);
}
} | [
"function",
"(",
"command",
")",
"{",
"var",
"align",
"=",
"command",
".",
"substring",
"(",
"7",
")",
";",
"if",
"(",
"align",
"==",
"'full'",
")",
"{",
"align",
"=",
"'justify'",
";",
"}",
"// Remove all other alignments first",
"each",
"(",
"'left,center,right,justify'",
".",
"split",
"(",
"','",
")",
",",
"function",
"(",
"name",
")",
"{",
"if",
"(",
"align",
"!=",
"name",
")",
"{",
"formatter",
".",
"remove",
"(",
"'align'",
"+",
"name",
")",
";",
"}",
"}",
")",
";",
"if",
"(",
"align",
"!=",
"'none'",
")",
"{",
"toggleFormat",
"(",
"'align'",
"+",
"align",
")",
";",
"}",
"}"
] | Override justify commands to use the text formatter engine | [
"Override",
"justify",
"commands",
"to",
"use",
"the",
"text",
"formatter",
"engine"
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L23871-L23888 |
|
48,212 | sadiqhabib/tinymce-dist | tinymce.full.js | hasRightSideContent | function hasRightSideContent() {
var walker = new TreeWalker(container, parentBlock), node;
var nonEmptyElementsMap = editor.schema.getNonEmptyElements();
while ((node = walker.next())) {
if (nonEmptyElementsMap[node.nodeName.toLowerCase()] || node.length > 0) {
return true;
}
}
} | javascript | function hasRightSideContent() {
var walker = new TreeWalker(container, parentBlock), node;
var nonEmptyElementsMap = editor.schema.getNonEmptyElements();
while ((node = walker.next())) {
if (nonEmptyElementsMap[node.nodeName.toLowerCase()] || node.length > 0) {
return true;
}
}
} | [
"function",
"hasRightSideContent",
"(",
")",
"{",
"var",
"walker",
"=",
"new",
"TreeWalker",
"(",
"container",
",",
"parentBlock",
")",
",",
"node",
";",
"var",
"nonEmptyElementsMap",
"=",
"editor",
".",
"schema",
".",
"getNonEmptyElements",
"(",
")",
";",
"while",
"(",
"(",
"node",
"=",
"walker",
".",
"next",
"(",
")",
")",
")",
"{",
"if",
"(",
"nonEmptyElementsMap",
"[",
"node",
".",
"nodeName",
".",
"toLowerCase",
"(",
")",
"]",
"||",
"node",
".",
"length",
">",
"0",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}"
] | Walks the parent block to the right and look for BR elements | [
"Walks",
"the",
"parent",
"block",
"to",
"the",
"right",
"and",
"look",
"for",
"BR",
"elements"
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L24166-L24175 |
48,213 | sadiqhabib/tinymce-dist | tinymce.full.js | URI | function URI(url, settings) {
var self = this, baseUri, baseUrl;
url = trim(url);
settings = self.settings = settings || {};
baseUri = settings.base_uri;
// Strange app protocol that isn't http/https or local anchor
// For example: mailto,skype,tel etc.
if (/^([\w\-]+):([^\/]{2})/i.test(url) || /^\s*#/.test(url)) {
self.source = url;
return;
}
var isProtocolRelative = url.indexOf('//') === 0;
// Absolute path with no host, fake host and protocol
if (url.indexOf('/') === 0 && !isProtocolRelative) {
url = (baseUri ? baseUri.protocol || 'http' : 'http') + '://mce_host' + url;
}
// Relative path http:// or protocol relative //path
if (!/^[\w\-]*:?\/\//.test(url)) {
baseUrl = settings.base_uri ? settings.base_uri.path : new URI(location.href).directory;
if (settings.base_uri.protocol === "") {
url = '//mce_host' + self.toAbsPath(baseUrl, url);
} else {
url = /([^#?]*)([#?]?.*)/.exec(url);
url = ((baseUri && baseUri.protocol) || 'http') + '://mce_host' + self.toAbsPath(baseUrl, url[1]) + url[2];
}
}
// Parse URL (Credits goes to Steave, http://blog.stevenlevithan.com/archives/parseuri)
url = url.replace(/@@/g, '(mce_at)'); // Zope 3 workaround, they use @@something
/*jshint maxlen: 255 */
/*eslint max-len: 0 */
url = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(url);
each(queryParts, function (v, i) {
var part = url[i];
// Zope 3 workaround, they use @@something
if (part) {
part = part.replace(/\(mce_at\)/g, '@@');
}
self[v] = part;
});
if (baseUri) {
if (!self.protocol) {
self.protocol = baseUri.protocol;
}
if (!self.userInfo) {
self.userInfo = baseUri.userInfo;
}
if (!self.port && self.host === 'mce_host') {
self.port = baseUri.port;
}
if (!self.host || self.host === 'mce_host') {
self.host = baseUri.host;
}
self.source = '';
}
if (isProtocolRelative) {
self.protocol = '';
}
//t.path = t.path || '/';
} | javascript | function URI(url, settings) {
var self = this, baseUri, baseUrl;
url = trim(url);
settings = self.settings = settings || {};
baseUri = settings.base_uri;
// Strange app protocol that isn't http/https or local anchor
// For example: mailto,skype,tel etc.
if (/^([\w\-]+):([^\/]{2})/i.test(url) || /^\s*#/.test(url)) {
self.source = url;
return;
}
var isProtocolRelative = url.indexOf('//') === 0;
// Absolute path with no host, fake host and protocol
if (url.indexOf('/') === 0 && !isProtocolRelative) {
url = (baseUri ? baseUri.protocol || 'http' : 'http') + '://mce_host' + url;
}
// Relative path http:// or protocol relative //path
if (!/^[\w\-]*:?\/\//.test(url)) {
baseUrl = settings.base_uri ? settings.base_uri.path : new URI(location.href).directory;
if (settings.base_uri.protocol === "") {
url = '//mce_host' + self.toAbsPath(baseUrl, url);
} else {
url = /([^#?]*)([#?]?.*)/.exec(url);
url = ((baseUri && baseUri.protocol) || 'http') + '://mce_host' + self.toAbsPath(baseUrl, url[1]) + url[2];
}
}
// Parse URL (Credits goes to Steave, http://blog.stevenlevithan.com/archives/parseuri)
url = url.replace(/@@/g, '(mce_at)'); // Zope 3 workaround, they use @@something
/*jshint maxlen: 255 */
/*eslint max-len: 0 */
url = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(url);
each(queryParts, function (v, i) {
var part = url[i];
// Zope 3 workaround, they use @@something
if (part) {
part = part.replace(/\(mce_at\)/g, '@@');
}
self[v] = part;
});
if (baseUri) {
if (!self.protocol) {
self.protocol = baseUri.protocol;
}
if (!self.userInfo) {
self.userInfo = baseUri.userInfo;
}
if (!self.port && self.host === 'mce_host') {
self.port = baseUri.port;
}
if (!self.host || self.host === 'mce_host') {
self.host = baseUri.host;
}
self.source = '';
}
if (isProtocolRelative) {
self.protocol = '';
}
//t.path = t.path || '/';
} | [
"function",
"URI",
"(",
"url",
",",
"settings",
")",
"{",
"var",
"self",
"=",
"this",
",",
"baseUri",
",",
"baseUrl",
";",
"url",
"=",
"trim",
"(",
"url",
")",
";",
"settings",
"=",
"self",
".",
"settings",
"=",
"settings",
"||",
"{",
"}",
";",
"baseUri",
"=",
"settings",
".",
"base_uri",
";",
"// Strange app protocol that isn't http/https or local anchor",
"// For example: mailto,skype,tel etc.",
"if",
"(",
"/",
"^([\\w\\-]+):([^\\/]{2})",
"/",
"i",
".",
"test",
"(",
"url",
")",
"||",
"/",
"^\\s*#",
"/",
".",
"test",
"(",
"url",
")",
")",
"{",
"self",
".",
"source",
"=",
"url",
";",
"return",
";",
"}",
"var",
"isProtocolRelative",
"=",
"url",
".",
"indexOf",
"(",
"'//'",
")",
"===",
"0",
";",
"// Absolute path with no host, fake host and protocol",
"if",
"(",
"url",
".",
"indexOf",
"(",
"'/'",
")",
"===",
"0",
"&&",
"!",
"isProtocolRelative",
")",
"{",
"url",
"=",
"(",
"baseUri",
"?",
"baseUri",
".",
"protocol",
"||",
"'http'",
":",
"'http'",
")",
"+",
"'://mce_host'",
"+",
"url",
";",
"}",
"// Relative path http:// or protocol relative //path",
"if",
"(",
"!",
"/",
"^[\\w\\-]*:?\\/\\/",
"/",
".",
"test",
"(",
"url",
")",
")",
"{",
"baseUrl",
"=",
"settings",
".",
"base_uri",
"?",
"settings",
".",
"base_uri",
".",
"path",
":",
"new",
"URI",
"(",
"location",
".",
"href",
")",
".",
"directory",
";",
"if",
"(",
"settings",
".",
"base_uri",
".",
"protocol",
"===",
"\"\"",
")",
"{",
"url",
"=",
"'//mce_host'",
"+",
"self",
".",
"toAbsPath",
"(",
"baseUrl",
",",
"url",
")",
";",
"}",
"else",
"{",
"url",
"=",
"/",
"([^#?]*)([#?]?.*)",
"/",
".",
"exec",
"(",
"url",
")",
";",
"url",
"=",
"(",
"(",
"baseUri",
"&&",
"baseUri",
".",
"protocol",
")",
"||",
"'http'",
")",
"+",
"'://mce_host'",
"+",
"self",
".",
"toAbsPath",
"(",
"baseUrl",
",",
"url",
"[",
"1",
"]",
")",
"+",
"url",
"[",
"2",
"]",
";",
"}",
"}",
"// Parse URL (Credits goes to Steave, http://blog.stevenlevithan.com/archives/parseuri)",
"url",
"=",
"url",
".",
"replace",
"(",
"/",
"@@",
"/",
"g",
",",
"'(mce_at)'",
")",
";",
"// Zope 3 workaround, they use @@something",
"/*jshint maxlen: 255 */",
"/*eslint max-len: 0 */",
"url",
"=",
"/",
"^(?:(?![^:@]+:[^:@\\/]*@)([^:\\/?#.]+):)?(?:\\/\\/)?((?:(([^:@\\/]*):?([^:@\\/]*))?@)?([^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)",
"/",
".",
"exec",
"(",
"url",
")",
";",
"each",
"(",
"queryParts",
",",
"function",
"(",
"v",
",",
"i",
")",
"{",
"var",
"part",
"=",
"url",
"[",
"i",
"]",
";",
"// Zope 3 workaround, they use @@something",
"if",
"(",
"part",
")",
"{",
"part",
"=",
"part",
".",
"replace",
"(",
"/",
"\\(mce_at\\)",
"/",
"g",
",",
"'@@'",
")",
";",
"}",
"self",
"[",
"v",
"]",
"=",
"part",
";",
"}",
")",
";",
"if",
"(",
"baseUri",
")",
"{",
"if",
"(",
"!",
"self",
".",
"protocol",
")",
"{",
"self",
".",
"protocol",
"=",
"baseUri",
".",
"protocol",
";",
"}",
"if",
"(",
"!",
"self",
".",
"userInfo",
")",
"{",
"self",
".",
"userInfo",
"=",
"baseUri",
".",
"userInfo",
";",
"}",
"if",
"(",
"!",
"self",
".",
"port",
"&&",
"self",
".",
"host",
"===",
"'mce_host'",
")",
"{",
"self",
".",
"port",
"=",
"baseUri",
".",
"port",
";",
"}",
"if",
"(",
"!",
"self",
".",
"host",
"||",
"self",
".",
"host",
"===",
"'mce_host'",
")",
"{",
"self",
".",
"host",
"=",
"baseUri",
".",
"host",
";",
"}",
"self",
".",
"source",
"=",
"''",
";",
"}",
"if",
"(",
"isProtocolRelative",
")",
"{",
"self",
".",
"protocol",
"=",
"''",
";",
"}",
"//t.path = t.path || '/';",
"}"
] | Constructs a new URI instance.
@constructor
@method URI
@param {String} url URI string to parse.
@param {Object} settings Optional settings object. | [
"Constructs",
"a",
"new",
"URI",
"instance",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L24337-L24412 |
48,214 | sadiqhabib/tinymce-dist | tinymce.full.js | function (path) {
var self = this;
path = /^(.*?)\/?(\w+)?$/.exec(path);
// Update path parts
self.path = path[0];
self.directory = path[1];
self.file = path[2];
// Rebuild source
self.source = '';
self.getURI();
} | javascript | function (path) {
var self = this;
path = /^(.*?)\/?(\w+)?$/.exec(path);
// Update path parts
self.path = path[0];
self.directory = path[1];
self.file = path[2];
// Rebuild source
self.source = '';
self.getURI();
} | [
"function",
"(",
"path",
")",
"{",
"var",
"self",
"=",
"this",
";",
"path",
"=",
"/",
"^(.*?)\\/?(\\w+)?$",
"/",
".",
"exec",
"(",
"path",
")",
";",
"// Update path parts",
"self",
".",
"path",
"=",
"path",
"[",
"0",
"]",
";",
"self",
".",
"directory",
"=",
"path",
"[",
"1",
"]",
";",
"self",
".",
"file",
"=",
"path",
"[",
"2",
"]",
";",
"// Rebuild source",
"self",
".",
"source",
"=",
"''",
";",
"self",
".",
"getURI",
"(",
")",
";",
"}"
] | Sets the internal path part of the URI.
@method setPath
@param {string} path Path string to set. | [
"Sets",
"the",
"internal",
"path",
"part",
"of",
"the",
"URI",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L24421-L24434 |
|
48,215 | sadiqhabib/tinymce-dist | tinymce.full.js | function (uri) {
var self = this, output;
if (uri === "./") {
return uri;
}
uri = new URI(uri, { base_uri: self });
// Not on same domain/port or protocol
if ((uri.host != 'mce_host' && self.host != uri.host && uri.host) || self.port != uri.port ||
(self.protocol != uri.protocol && uri.protocol !== "")) {
return uri.getURI();
}
var tu = self.getURI(), uu = uri.getURI();
// Allow usage of the base_uri when relative_urls = true
if (tu == uu || (tu.charAt(tu.length - 1) == "/" && tu.substr(0, tu.length - 1) == uu)) {
return tu;
}
output = self.toRelPath(self.path, uri.path);
// Add query
if (uri.query) {
output += '?' + uri.query;
}
// Add anchor
if (uri.anchor) {
output += '#' + uri.anchor;
}
return output;
} | javascript | function (uri) {
var self = this, output;
if (uri === "./") {
return uri;
}
uri = new URI(uri, { base_uri: self });
// Not on same domain/port or protocol
if ((uri.host != 'mce_host' && self.host != uri.host && uri.host) || self.port != uri.port ||
(self.protocol != uri.protocol && uri.protocol !== "")) {
return uri.getURI();
}
var tu = self.getURI(), uu = uri.getURI();
// Allow usage of the base_uri when relative_urls = true
if (tu == uu || (tu.charAt(tu.length - 1) == "/" && tu.substr(0, tu.length - 1) == uu)) {
return tu;
}
output = self.toRelPath(self.path, uri.path);
// Add query
if (uri.query) {
output += '?' + uri.query;
}
// Add anchor
if (uri.anchor) {
output += '#' + uri.anchor;
}
return output;
} | [
"function",
"(",
"uri",
")",
"{",
"var",
"self",
"=",
"this",
",",
"output",
";",
"if",
"(",
"uri",
"===",
"\"./\"",
")",
"{",
"return",
"uri",
";",
"}",
"uri",
"=",
"new",
"URI",
"(",
"uri",
",",
"{",
"base_uri",
":",
"self",
"}",
")",
";",
"// Not on same domain/port or protocol",
"if",
"(",
"(",
"uri",
".",
"host",
"!=",
"'mce_host'",
"&&",
"self",
".",
"host",
"!=",
"uri",
".",
"host",
"&&",
"uri",
".",
"host",
")",
"||",
"self",
".",
"port",
"!=",
"uri",
".",
"port",
"||",
"(",
"self",
".",
"protocol",
"!=",
"uri",
".",
"protocol",
"&&",
"uri",
".",
"protocol",
"!==",
"\"\"",
")",
")",
"{",
"return",
"uri",
".",
"getURI",
"(",
")",
";",
"}",
"var",
"tu",
"=",
"self",
".",
"getURI",
"(",
")",
",",
"uu",
"=",
"uri",
".",
"getURI",
"(",
")",
";",
"// Allow usage of the base_uri when relative_urls = true",
"if",
"(",
"tu",
"==",
"uu",
"||",
"(",
"tu",
".",
"charAt",
"(",
"tu",
".",
"length",
"-",
"1",
")",
"==",
"\"/\"",
"&&",
"tu",
".",
"substr",
"(",
"0",
",",
"tu",
".",
"length",
"-",
"1",
")",
"==",
"uu",
")",
")",
"{",
"return",
"tu",
";",
"}",
"output",
"=",
"self",
".",
"toRelPath",
"(",
"self",
".",
"path",
",",
"uri",
".",
"path",
")",
";",
"// Add query",
"if",
"(",
"uri",
".",
"query",
")",
"{",
"output",
"+=",
"'?'",
"+",
"uri",
".",
"query",
";",
"}",
"// Add anchor",
"if",
"(",
"uri",
".",
"anchor",
")",
"{",
"output",
"+=",
"'#'",
"+",
"uri",
".",
"anchor",
";",
"}",
"return",
"output",
";",
"}"
] | Converts the specified URI into a relative URI based on the current URI instance location.
@method toRelative
@param {String} uri URI to convert into a relative path/URI.
@return {String} Relative URI from the point specified in the current URI instance.
@example
// Converts an absolute URL to an relative URL url will be somedir/somefile.htm
var url = new tinymce.util.URI('http://www.site.com/dir/').toRelative('http://www.site.com/dir/somedir/somefile.htm'); | [
"Converts",
"the",
"specified",
"URI",
"into",
"a",
"relative",
"URI",
"based",
"on",
"the",
"current",
"URI",
"instance",
"location",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L24446-L24481 |
|
48,216 | sadiqhabib/tinymce-dist | tinymce.full.js | function (uri, noHost) {
uri = new URI(uri, { base_uri: this });
return uri.getURI(noHost && this.isSameOrigin(uri));
} | javascript | function (uri, noHost) {
uri = new URI(uri, { base_uri: this });
return uri.getURI(noHost && this.isSameOrigin(uri));
} | [
"function",
"(",
"uri",
",",
"noHost",
")",
"{",
"uri",
"=",
"new",
"URI",
"(",
"uri",
",",
"{",
"base_uri",
":",
"this",
"}",
")",
";",
"return",
"uri",
".",
"getURI",
"(",
"noHost",
"&&",
"this",
".",
"isSameOrigin",
"(",
"uri",
")",
")",
";",
"}"
] | Converts the specified URI into a absolute URI based on the current URI instance location.
@method toAbsolute
@param {String} uri URI to convert into a relative path/URI.
@param {Boolean} noHost No host and protocol prefix.
@return {String} Absolute URI from the point specified in the current URI instance.
@example
// Converts an relative URL to an absolute URL url will be http://www.site.com/dir/somedir/somefile.htm
var url = new tinymce.util.URI('http://www.site.com/dir/').toAbsolute('somedir/somefile.htm'); | [
"Converts",
"the",
"specified",
"URI",
"into",
"a",
"absolute",
"URI",
"based",
"on",
"the",
"current",
"URI",
"instance",
"location",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L24494-L24498 |
|
48,217 | sadiqhabib/tinymce-dist | tinymce.full.js | function (noProtoHost) {
var s, self = this;
// Rebuild source
if (!self.source || noProtoHost) {
s = '';
if (!noProtoHost) {
if (self.protocol) {
s += self.protocol + '://';
} else {
s += '//';
}
if (self.userInfo) {
s += self.userInfo + '@';
}
if (self.host) {
s += self.host;
}
if (self.port) {
s += ':' + self.port;
}
}
if (self.path) {
s += self.path;
}
if (self.query) {
s += '?' + self.query;
}
if (self.anchor) {
s += '#' + self.anchor;
}
self.source = s;
}
return self.source;
} | javascript | function (noProtoHost) {
var s, self = this;
// Rebuild source
if (!self.source || noProtoHost) {
s = '';
if (!noProtoHost) {
if (self.protocol) {
s += self.protocol + '://';
} else {
s += '//';
}
if (self.userInfo) {
s += self.userInfo + '@';
}
if (self.host) {
s += self.host;
}
if (self.port) {
s += ':' + self.port;
}
}
if (self.path) {
s += self.path;
}
if (self.query) {
s += '?' + self.query;
}
if (self.anchor) {
s += '#' + self.anchor;
}
self.source = s;
}
return self.source;
} | [
"function",
"(",
"noProtoHost",
")",
"{",
"var",
"s",
",",
"self",
"=",
"this",
";",
"// Rebuild source",
"if",
"(",
"!",
"self",
".",
"source",
"||",
"noProtoHost",
")",
"{",
"s",
"=",
"''",
";",
"if",
"(",
"!",
"noProtoHost",
")",
"{",
"if",
"(",
"self",
".",
"protocol",
")",
"{",
"s",
"+=",
"self",
".",
"protocol",
"+",
"'://'",
";",
"}",
"else",
"{",
"s",
"+=",
"'//'",
";",
"}",
"if",
"(",
"self",
".",
"userInfo",
")",
"{",
"s",
"+=",
"self",
".",
"userInfo",
"+",
"'@'",
";",
"}",
"if",
"(",
"self",
".",
"host",
")",
"{",
"s",
"+=",
"self",
".",
"host",
";",
"}",
"if",
"(",
"self",
".",
"port",
")",
"{",
"s",
"+=",
"':'",
"+",
"self",
".",
"port",
";",
"}",
"}",
"if",
"(",
"self",
".",
"path",
")",
"{",
"s",
"+=",
"self",
".",
"path",
";",
"}",
"if",
"(",
"self",
".",
"query",
")",
"{",
"s",
"+=",
"'?'",
"+",
"self",
".",
"query",
";",
"}",
"if",
"(",
"self",
".",
"anchor",
")",
"{",
"s",
"+=",
"'#'",
"+",
"self",
".",
"anchor",
";",
"}",
"self",
".",
"source",
"=",
"s",
";",
"}",
"return",
"self",
".",
"source",
";",
"}"
] | Returns the full URI of the internal structure.
@method getURI
@param {Boolean} noProtoHost Optional no host and protocol part. Defaults to false. | [
"Returns",
"the",
"full",
"URI",
"of",
"the",
"internal",
"structure",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L24650-L24693 |
|
48,218 | sadiqhabib/tinymce-dist | tinymce.full.js | fire | function fire(name, args) {
var handlers, i, l, callback;
name = name.toLowerCase();
args = args || {};
args.type = name;
// Setup target is there isn't one
if (!args.target) {
args.target = scope;
}
// Add event delegation methods if they are missing
if (!args.preventDefault) {
// Add preventDefault method
args.preventDefault = function () {
args.isDefaultPrevented = returnTrue;
};
// Add stopPropagation
args.stopPropagation = function () {
args.isPropagationStopped = returnTrue;
};
// Add stopImmediatePropagation
args.stopImmediatePropagation = function () {
args.isImmediatePropagationStopped = returnTrue;
};
// Add event delegation states
args.isDefaultPrevented = returnFalse;
args.isPropagationStopped = returnFalse;
args.isImmediatePropagationStopped = returnFalse;
}
if (settings.beforeFire) {
settings.beforeFire(args);
}
handlers = bindings[name];
if (handlers) {
for (i = 0, l = handlers.length; i < l; i++) {
callback = handlers[i];
// Unbind handlers marked with "once"
if (callback.once) {
off(name, callback.func);
}
// Stop immediate propagation if needed
if (args.isImmediatePropagationStopped()) {
args.stopPropagation();
return args;
}
// If callback returns false then prevent default and stop all propagation
if (callback.func.call(scope, args) === false) {
args.preventDefault();
return args;
}
}
}
return args;
} | javascript | function fire(name, args) {
var handlers, i, l, callback;
name = name.toLowerCase();
args = args || {};
args.type = name;
// Setup target is there isn't one
if (!args.target) {
args.target = scope;
}
// Add event delegation methods if they are missing
if (!args.preventDefault) {
// Add preventDefault method
args.preventDefault = function () {
args.isDefaultPrevented = returnTrue;
};
// Add stopPropagation
args.stopPropagation = function () {
args.isPropagationStopped = returnTrue;
};
// Add stopImmediatePropagation
args.stopImmediatePropagation = function () {
args.isImmediatePropagationStopped = returnTrue;
};
// Add event delegation states
args.isDefaultPrevented = returnFalse;
args.isPropagationStopped = returnFalse;
args.isImmediatePropagationStopped = returnFalse;
}
if (settings.beforeFire) {
settings.beforeFire(args);
}
handlers = bindings[name];
if (handlers) {
for (i = 0, l = handlers.length; i < l; i++) {
callback = handlers[i];
// Unbind handlers marked with "once"
if (callback.once) {
off(name, callback.func);
}
// Stop immediate propagation if needed
if (args.isImmediatePropagationStopped()) {
args.stopPropagation();
return args;
}
// If callback returns false then prevent default and stop all propagation
if (callback.func.call(scope, args) === false) {
args.preventDefault();
return args;
}
}
}
return args;
} | [
"function",
"fire",
"(",
"name",
",",
"args",
")",
"{",
"var",
"handlers",
",",
"i",
",",
"l",
",",
"callback",
";",
"name",
"=",
"name",
".",
"toLowerCase",
"(",
")",
";",
"args",
"=",
"args",
"||",
"{",
"}",
";",
"args",
".",
"type",
"=",
"name",
";",
"// Setup target is there isn't one",
"if",
"(",
"!",
"args",
".",
"target",
")",
"{",
"args",
".",
"target",
"=",
"scope",
";",
"}",
"// Add event delegation methods if they are missing",
"if",
"(",
"!",
"args",
".",
"preventDefault",
")",
"{",
"// Add preventDefault method",
"args",
".",
"preventDefault",
"=",
"function",
"(",
")",
"{",
"args",
".",
"isDefaultPrevented",
"=",
"returnTrue",
";",
"}",
";",
"// Add stopPropagation",
"args",
".",
"stopPropagation",
"=",
"function",
"(",
")",
"{",
"args",
".",
"isPropagationStopped",
"=",
"returnTrue",
";",
"}",
";",
"// Add stopImmediatePropagation",
"args",
".",
"stopImmediatePropagation",
"=",
"function",
"(",
")",
"{",
"args",
".",
"isImmediatePropagationStopped",
"=",
"returnTrue",
";",
"}",
";",
"// Add event delegation states",
"args",
".",
"isDefaultPrevented",
"=",
"returnFalse",
";",
"args",
".",
"isPropagationStopped",
"=",
"returnFalse",
";",
"args",
".",
"isImmediatePropagationStopped",
"=",
"returnFalse",
";",
"}",
"if",
"(",
"settings",
".",
"beforeFire",
")",
"{",
"settings",
".",
"beforeFire",
"(",
"args",
")",
";",
"}",
"handlers",
"=",
"bindings",
"[",
"name",
"]",
";",
"if",
"(",
"handlers",
")",
"{",
"for",
"(",
"i",
"=",
"0",
",",
"l",
"=",
"handlers",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"callback",
"=",
"handlers",
"[",
"i",
"]",
";",
"// Unbind handlers marked with \"once\"",
"if",
"(",
"callback",
".",
"once",
")",
"{",
"off",
"(",
"name",
",",
"callback",
".",
"func",
")",
";",
"}",
"// Stop immediate propagation if needed",
"if",
"(",
"args",
".",
"isImmediatePropagationStopped",
"(",
")",
")",
"{",
"args",
".",
"stopPropagation",
"(",
")",
";",
"return",
"args",
";",
"}",
"// If callback returns false then prevent default and stop all propagation",
"if",
"(",
"callback",
".",
"func",
".",
"call",
"(",
"scope",
",",
"args",
")",
"===",
"false",
")",
"{",
"args",
".",
"preventDefault",
"(",
")",
";",
"return",
"args",
";",
"}",
"}",
"}",
"return",
"args",
";",
"}"
] | Fires the specified event by name.
@method fire
@param {String} name Name of the event to fire.
@param {Object?} args Event arguments.
@return {Object} Event args instance passed in.
@example
instance.fire('event', {...}); | [
"Fires",
"the",
"specified",
"event",
"by",
"name",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L24968-L25032 |
48,219 | sadiqhabib/tinymce-dist | tinymce.full.js | on | function on(name, callback, prepend, extra) {
var handlers, names, i;
if (callback === false) {
callback = returnFalse;
}
if (callback) {
callback = {
func: callback
};
if (extra) {
Tools.extend(callback, extra);
}
names = name.toLowerCase().split(' ');
i = names.length;
while (i--) {
name = names[i];
handlers = bindings[name];
if (!handlers) {
handlers = bindings[name] = [];
toggleEvent(name, true);
}
if (prepend) {
handlers.unshift(callback);
} else {
handlers.push(callback);
}
}
}
return self;
} | javascript | function on(name, callback, prepend, extra) {
var handlers, names, i;
if (callback === false) {
callback = returnFalse;
}
if (callback) {
callback = {
func: callback
};
if (extra) {
Tools.extend(callback, extra);
}
names = name.toLowerCase().split(' ');
i = names.length;
while (i--) {
name = names[i];
handlers = bindings[name];
if (!handlers) {
handlers = bindings[name] = [];
toggleEvent(name, true);
}
if (prepend) {
handlers.unshift(callback);
} else {
handlers.push(callback);
}
}
}
return self;
} | [
"function",
"on",
"(",
"name",
",",
"callback",
",",
"prepend",
",",
"extra",
")",
"{",
"var",
"handlers",
",",
"names",
",",
"i",
";",
"if",
"(",
"callback",
"===",
"false",
")",
"{",
"callback",
"=",
"returnFalse",
";",
"}",
"if",
"(",
"callback",
")",
"{",
"callback",
"=",
"{",
"func",
":",
"callback",
"}",
";",
"if",
"(",
"extra",
")",
"{",
"Tools",
".",
"extend",
"(",
"callback",
",",
"extra",
")",
";",
"}",
"names",
"=",
"name",
".",
"toLowerCase",
"(",
")",
".",
"split",
"(",
"' '",
")",
";",
"i",
"=",
"names",
".",
"length",
";",
"while",
"(",
"i",
"--",
")",
"{",
"name",
"=",
"names",
"[",
"i",
"]",
";",
"handlers",
"=",
"bindings",
"[",
"name",
"]",
";",
"if",
"(",
"!",
"handlers",
")",
"{",
"handlers",
"=",
"bindings",
"[",
"name",
"]",
"=",
"[",
"]",
";",
"toggleEvent",
"(",
"name",
",",
"true",
")",
";",
"}",
"if",
"(",
"prepend",
")",
"{",
"handlers",
".",
"unshift",
"(",
"callback",
")",
";",
"}",
"else",
"{",
"handlers",
".",
"push",
"(",
"callback",
")",
";",
"}",
"}",
"}",
"return",
"self",
";",
"}"
] | Binds an event listener to a specific event by name.
@method on
@param {String} name Event name or space separated list of events to bind.
@param {callback} callback Callback to be executed when the event occurs.
@param {Boolean} first Optional flag if the event should be prepended. Use this with care.
@return {Object} Current class instance.
@example
instance.on('event', function(e) {
// Callback logic
}); | [
"Binds",
"an",
"event",
"listener",
"to",
"a",
"specific",
"event",
"by",
"name",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L25047-L25082 |
48,220 | sadiqhabib/tinymce-dist | tinymce.full.js | off | function off(name, callback) {
var i, handlers, bindingName, names, hi;
if (name) {
names = name.toLowerCase().split(' ');
i = names.length;
while (i--) {
name = names[i];
handlers = bindings[name];
// Unbind all handlers
if (!name) {
for (bindingName in bindings) {
toggleEvent(bindingName, false);
delete bindings[bindingName];
}
return self;
}
if (handlers) {
// Unbind all by name
if (!callback) {
handlers.length = 0;
} else {
// Unbind specific ones
hi = handlers.length;
while (hi--) {
if (handlers[hi].func === callback) {
handlers = handlers.slice(0, hi).concat(handlers.slice(hi + 1));
bindings[name] = handlers;
}
}
}
if (!handlers.length) {
toggleEvent(name, false);
delete bindings[name];
}
}
}
} else {
for (name in bindings) {
toggleEvent(name, false);
}
bindings = {};
}
return self;
} | javascript | function off(name, callback) {
var i, handlers, bindingName, names, hi;
if (name) {
names = name.toLowerCase().split(' ');
i = names.length;
while (i--) {
name = names[i];
handlers = bindings[name];
// Unbind all handlers
if (!name) {
for (bindingName in bindings) {
toggleEvent(bindingName, false);
delete bindings[bindingName];
}
return self;
}
if (handlers) {
// Unbind all by name
if (!callback) {
handlers.length = 0;
} else {
// Unbind specific ones
hi = handlers.length;
while (hi--) {
if (handlers[hi].func === callback) {
handlers = handlers.slice(0, hi).concat(handlers.slice(hi + 1));
bindings[name] = handlers;
}
}
}
if (!handlers.length) {
toggleEvent(name, false);
delete bindings[name];
}
}
}
} else {
for (name in bindings) {
toggleEvent(name, false);
}
bindings = {};
}
return self;
} | [
"function",
"off",
"(",
"name",
",",
"callback",
")",
"{",
"var",
"i",
",",
"handlers",
",",
"bindingName",
",",
"names",
",",
"hi",
";",
"if",
"(",
"name",
")",
"{",
"names",
"=",
"name",
".",
"toLowerCase",
"(",
")",
".",
"split",
"(",
"' '",
")",
";",
"i",
"=",
"names",
".",
"length",
";",
"while",
"(",
"i",
"--",
")",
"{",
"name",
"=",
"names",
"[",
"i",
"]",
";",
"handlers",
"=",
"bindings",
"[",
"name",
"]",
";",
"// Unbind all handlers",
"if",
"(",
"!",
"name",
")",
"{",
"for",
"(",
"bindingName",
"in",
"bindings",
")",
"{",
"toggleEvent",
"(",
"bindingName",
",",
"false",
")",
";",
"delete",
"bindings",
"[",
"bindingName",
"]",
";",
"}",
"return",
"self",
";",
"}",
"if",
"(",
"handlers",
")",
"{",
"// Unbind all by name",
"if",
"(",
"!",
"callback",
")",
"{",
"handlers",
".",
"length",
"=",
"0",
";",
"}",
"else",
"{",
"// Unbind specific ones",
"hi",
"=",
"handlers",
".",
"length",
";",
"while",
"(",
"hi",
"--",
")",
"{",
"if",
"(",
"handlers",
"[",
"hi",
"]",
".",
"func",
"===",
"callback",
")",
"{",
"handlers",
"=",
"handlers",
".",
"slice",
"(",
"0",
",",
"hi",
")",
".",
"concat",
"(",
"handlers",
".",
"slice",
"(",
"hi",
"+",
"1",
")",
")",
";",
"bindings",
"[",
"name",
"]",
"=",
"handlers",
";",
"}",
"}",
"}",
"if",
"(",
"!",
"handlers",
".",
"length",
")",
"{",
"toggleEvent",
"(",
"name",
",",
"false",
")",
";",
"delete",
"bindings",
"[",
"name",
"]",
";",
"}",
"}",
"}",
"}",
"else",
"{",
"for",
"(",
"name",
"in",
"bindings",
")",
"{",
"toggleEvent",
"(",
"name",
",",
"false",
")",
";",
"}",
"bindings",
"=",
"{",
"}",
";",
"}",
"return",
"self",
";",
"}"
] | Unbinds an event listener to a specific event by name.
@method off
@param {String?} name Name of the event to unbind.
@param {callback?} callback Callback to unbind.
@return {Object} Current class instance.
@example
// Unbind specific callback
instance.off('event', handler);
// Unbind all listeners by name
instance.off('event');
// Unbind all events
instance.off(); | [
"Unbinds",
"an",
"event",
"listener",
"to",
"a",
"specific",
"event",
"by",
"name",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L25101-L25151 |
48,221 | sadiqhabib/tinymce-dist | tinymce.full.js | once | function once(name, callback, prepend) {
return on(name, callback, prepend, { once: true });
} | javascript | function once(name, callback, prepend) {
return on(name, callback, prepend, { once: true });
} | [
"function",
"once",
"(",
"name",
",",
"callback",
",",
"prepend",
")",
"{",
"return",
"on",
"(",
"name",
",",
"callback",
",",
"prepend",
",",
"{",
"once",
":",
"true",
"}",
")",
";",
"}"
] | Binds an event listener to a specific event by name
and automatically unbind the event once the callback fires.
@method once
@param {String} name Event name or space separated list of events to bind.
@param {callback} callback Callback to be executed when the event occurs.
@param {Boolean} first Optional flag if the event should be prepended. Use this with care.
@return {Object} Current class instance.
@example
instance.once('event', function(e) {
// Callback logic
}); | [
"Binds",
"an",
"event",
"listener",
"to",
"a",
"specific",
"event",
"by",
"name",
"and",
"automatically",
"unbind",
"the",
"event",
"once",
"the",
"callback",
"fires",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L25167-L25169 |
48,222 | sadiqhabib/tinymce-dist | tinymce.full.js | function (data) {
var name, value;
data = data || {};
for (name in data) {
value = data[name];
if (value instanceof Binding) {
data[name] = value.create(this, name);
}
}
this.data = data;
} | javascript | function (data) {
var name, value;
data = data || {};
for (name in data) {
value = data[name];
if (value instanceof Binding) {
data[name] = value.create(this, name);
}
}
this.data = data;
} | [
"function",
"(",
"data",
")",
"{",
"var",
"name",
",",
"value",
";",
"data",
"=",
"data",
"||",
"{",
"}",
";",
"for",
"(",
"name",
"in",
"data",
")",
"{",
"value",
"=",
"data",
"[",
"name",
"]",
";",
"if",
"(",
"value",
"instanceof",
"Binding",
")",
"{",
"data",
"[",
"name",
"]",
"=",
"value",
".",
"create",
"(",
"this",
",",
"name",
")",
";",
"}",
"}",
"this",
".",
"data",
"=",
"data",
";",
"}"
] | Constructs a new observable object instance.
@constructor
@param {Object} data Initial data for the object. | [
"Constructs",
"a",
"new",
"observable",
"object",
"instance",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L25522-L25536 |
|
48,223 | sadiqhabib/tinymce-dist | tinymce.full.js | function (name, value) {
var key, args, oldValue = this.data[name];
if (value instanceof Binding) {
value = value.create(this, name);
}
if (typeof name === "object") {
for (key in name) {
this.set(key, name[key]);
}
return this;
}
if (!isEqual(oldValue, value)) {
this.data[name] = value;
args = {
target: this,
name: name,
value: value,
oldValue: oldValue
};
this.fire('change:' + name, args);
this.fire('change', args);
}
return this;
} | javascript | function (name, value) {
var key, args, oldValue = this.data[name];
if (value instanceof Binding) {
value = value.create(this, name);
}
if (typeof name === "object") {
for (key in name) {
this.set(key, name[key]);
}
return this;
}
if (!isEqual(oldValue, value)) {
this.data[name] = value;
args = {
target: this,
name: name,
value: value,
oldValue: oldValue
};
this.fire('change:' + name, args);
this.fire('change', args);
}
return this;
} | [
"function",
"(",
"name",
",",
"value",
")",
"{",
"var",
"key",
",",
"args",
",",
"oldValue",
"=",
"this",
".",
"data",
"[",
"name",
"]",
";",
"if",
"(",
"value",
"instanceof",
"Binding",
")",
"{",
"value",
"=",
"value",
".",
"create",
"(",
"this",
",",
"name",
")",
";",
"}",
"if",
"(",
"typeof",
"name",
"===",
"\"object\"",
")",
"{",
"for",
"(",
"key",
"in",
"name",
")",
"{",
"this",
".",
"set",
"(",
"key",
",",
"name",
"[",
"key",
"]",
")",
";",
"}",
"return",
"this",
";",
"}",
"if",
"(",
"!",
"isEqual",
"(",
"oldValue",
",",
"value",
")",
")",
"{",
"this",
".",
"data",
"[",
"name",
"]",
"=",
"value",
";",
"args",
"=",
"{",
"target",
":",
"this",
",",
"name",
":",
"name",
",",
"value",
":",
"value",
",",
"oldValue",
":",
"oldValue",
"}",
";",
"this",
".",
"fire",
"(",
"'change:'",
"+",
"name",
",",
"args",
")",
";",
"this",
".",
"fire",
"(",
"'change'",
",",
"args",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Sets a property on the value this will call
observers if the value is a change from the current value.
@method set
@param {String/object} name Name of the property to set or a object of items to set.
@param {Object} value Value to set for the property.
@return {tinymce.data.ObservableObject} Observable object instance. | [
"Sets",
"a",
"property",
"on",
"the",
"value",
"this",
"will",
"call",
"observers",
"if",
"the",
"value",
"is",
"a",
"change",
"from",
"the",
"current",
"value",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L25547-L25577 |
|
48,224 | sadiqhabib/tinymce-dist | tinymce.full.js | unique | function unique(array) {
var uniqueItems = [], i = array.length, item;
while (i--) {
item = array[i];
if (!item.__checked) {
uniqueItems.push(item);
item.__checked = 1;
}
}
i = uniqueItems.length;
while (i--) {
delete uniqueItems[i].__checked;
}
return uniqueItems;
} | javascript | function unique(array) {
var uniqueItems = [], i = array.length, item;
while (i--) {
item = array[i];
if (!item.__checked) {
uniqueItems.push(item);
item.__checked = 1;
}
}
i = uniqueItems.length;
while (i--) {
delete uniqueItems[i].__checked;
}
return uniqueItems;
} | [
"function",
"unique",
"(",
"array",
")",
"{",
"var",
"uniqueItems",
"=",
"[",
"]",
",",
"i",
"=",
"array",
".",
"length",
",",
"item",
";",
"while",
"(",
"i",
"--",
")",
"{",
"item",
"=",
"array",
"[",
"i",
"]",
";",
"if",
"(",
"!",
"item",
".",
"__checked",
")",
"{",
"uniqueItems",
".",
"push",
"(",
"item",
")",
";",
"item",
".",
"__checked",
"=",
"1",
";",
"}",
"}",
"i",
"=",
"uniqueItems",
".",
"length",
";",
"while",
"(",
"i",
"--",
")",
"{",
"delete",
"uniqueItems",
"[",
"i",
"]",
".",
"__checked",
";",
"}",
"return",
"uniqueItems",
";",
"}"
] | Produces an array with a unique set of objects. It will not compare the values
but the references of the objects.
@private
@method unqiue
@param {Array} array Array to make into an array with unique items.
@return {Array} Array with unique items. | [
"Produces",
"an",
"array",
"with",
"a",
"unique",
"set",
"of",
"objects",
".",
"It",
"will",
"not",
"compare",
"the",
"values",
"but",
"the",
"references",
"of",
"the",
"objects",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L25681-L25699 |
48,225 | sadiqhabib/tinymce-dist | tinymce.full.js | parseChunks | function parseChunks(selector, selectors) {
var parts = [], extra, matches, i;
do {
chunker.exec("");
matches = chunker.exec(selector);
if (matches) {
selector = matches[3];
parts.push(matches[1]);
if (matches[2]) {
extra = matches[3];
break;
}
}
} while (matches);
if (extra) {
parseChunks(extra, selectors);
}
selector = [];
for (i = 0; i < parts.length; i++) {
if (parts[i] != '>') {
selector.push(compile(parts[i], [], parts[i - 1] === '>'));
}
}
selectors.push(selector);
return selectors;
} | javascript | function parseChunks(selector, selectors) {
var parts = [], extra, matches, i;
do {
chunker.exec("");
matches = chunker.exec(selector);
if (matches) {
selector = matches[3];
parts.push(matches[1]);
if (matches[2]) {
extra = matches[3];
break;
}
}
} while (matches);
if (extra) {
parseChunks(extra, selectors);
}
selector = [];
for (i = 0; i < parts.length; i++) {
if (parts[i] != '>') {
selector.push(compile(parts[i], [], parts[i - 1] === '>'));
}
}
selectors.push(selector);
return selectors;
} | [
"function",
"parseChunks",
"(",
"selector",
",",
"selectors",
")",
"{",
"var",
"parts",
"=",
"[",
"]",
",",
"extra",
",",
"matches",
",",
"i",
";",
"do",
"{",
"chunker",
".",
"exec",
"(",
"\"\"",
")",
";",
"matches",
"=",
"chunker",
".",
"exec",
"(",
"selector",
")",
";",
"if",
"(",
"matches",
")",
"{",
"selector",
"=",
"matches",
"[",
"3",
"]",
";",
"parts",
".",
"push",
"(",
"matches",
"[",
"1",
"]",
")",
";",
"if",
"(",
"matches",
"[",
"2",
"]",
")",
"{",
"extra",
"=",
"matches",
"[",
"3",
"]",
";",
"break",
";",
"}",
"}",
"}",
"while",
"(",
"matches",
")",
";",
"if",
"(",
"extra",
")",
"{",
"parseChunks",
"(",
"extra",
",",
"selectors",
")",
";",
"}",
"selector",
"=",
"[",
"]",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"parts",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"parts",
"[",
"i",
"]",
"!=",
"'>'",
")",
"{",
"selector",
".",
"push",
"(",
"compile",
"(",
"parts",
"[",
"i",
"]",
",",
"[",
"]",
",",
"parts",
"[",
"i",
"-",
"1",
"]",
"===",
"'>'",
")",
")",
";",
"}",
"}",
"selectors",
".",
"push",
"(",
"selector",
")",
";",
"return",
"selectors",
";",
"}"
] | Parser logic based on Sizzle by John Resig | [
"Parser",
"logic",
"based",
"on",
"Sizzle",
"by",
"John",
"Resig"
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L25827-L25859 |
48,226 | sadiqhabib/tinymce-dist | tinymce.full.js | function (container) {
var matches = [], i, l, selectors = this._selectors;
function collect(items, selector, index) {
var i, l, fi, fl, item, filters = selector[index];
for (i = 0, l = items.length; i < l; i++) {
item = items[i];
// Run each filter against the item
for (fi = 0, fl = filters.length; fi < fl; fi++) {
if (!filters[fi](item, i, l)) {
fi = fl + 1;
break;
}
}
// All filters matched the item
if (fi === fl) {
// Matched item is on the last expression like: panel toolbar [button]
if (index == selector.length - 1) {
matches.push(item);
} else {
// Collect next expression type
if (item.items) {
collect(item.items(), selector, index + 1);
}
}
} else if (filters.direct) {
return;
}
// Collect child items
if (item.items) {
collect(item.items(), selector, index);
}
}
}
if (container.items) {
for (i = 0, l = selectors.length; i < l; i++) {
collect(container.items(), selectors[i], 0);
}
// Unique the matches if needed
if (l > 1) {
matches = unique(matches);
}
}
// Fix for circular reference
if (!Collection) {
// TODO: Fix me!
Collection = Selector.Collection;
}
return new Collection(matches);
} | javascript | function (container) {
var matches = [], i, l, selectors = this._selectors;
function collect(items, selector, index) {
var i, l, fi, fl, item, filters = selector[index];
for (i = 0, l = items.length; i < l; i++) {
item = items[i];
// Run each filter against the item
for (fi = 0, fl = filters.length; fi < fl; fi++) {
if (!filters[fi](item, i, l)) {
fi = fl + 1;
break;
}
}
// All filters matched the item
if (fi === fl) {
// Matched item is on the last expression like: panel toolbar [button]
if (index == selector.length - 1) {
matches.push(item);
} else {
// Collect next expression type
if (item.items) {
collect(item.items(), selector, index + 1);
}
}
} else if (filters.direct) {
return;
}
// Collect child items
if (item.items) {
collect(item.items(), selector, index);
}
}
}
if (container.items) {
for (i = 0, l = selectors.length; i < l; i++) {
collect(container.items(), selectors[i], 0);
}
// Unique the matches if needed
if (l > 1) {
matches = unique(matches);
}
}
// Fix for circular reference
if (!Collection) {
// TODO: Fix me!
Collection = Selector.Collection;
}
return new Collection(matches);
} | [
"function",
"(",
"container",
")",
"{",
"var",
"matches",
"=",
"[",
"]",
",",
"i",
",",
"l",
",",
"selectors",
"=",
"this",
".",
"_selectors",
";",
"function",
"collect",
"(",
"items",
",",
"selector",
",",
"index",
")",
"{",
"var",
"i",
",",
"l",
",",
"fi",
",",
"fl",
",",
"item",
",",
"filters",
"=",
"selector",
"[",
"index",
"]",
";",
"for",
"(",
"i",
"=",
"0",
",",
"l",
"=",
"items",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"item",
"=",
"items",
"[",
"i",
"]",
";",
"// Run each filter against the item",
"for",
"(",
"fi",
"=",
"0",
",",
"fl",
"=",
"filters",
".",
"length",
";",
"fi",
"<",
"fl",
";",
"fi",
"++",
")",
"{",
"if",
"(",
"!",
"filters",
"[",
"fi",
"]",
"(",
"item",
",",
"i",
",",
"l",
")",
")",
"{",
"fi",
"=",
"fl",
"+",
"1",
";",
"break",
";",
"}",
"}",
"// All filters matched the item",
"if",
"(",
"fi",
"===",
"fl",
")",
"{",
"// Matched item is on the last expression like: panel toolbar [button]",
"if",
"(",
"index",
"==",
"selector",
".",
"length",
"-",
"1",
")",
"{",
"matches",
".",
"push",
"(",
"item",
")",
";",
"}",
"else",
"{",
"// Collect next expression type",
"if",
"(",
"item",
".",
"items",
")",
"{",
"collect",
"(",
"item",
".",
"items",
"(",
")",
",",
"selector",
",",
"index",
"+",
"1",
")",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"filters",
".",
"direct",
")",
"{",
"return",
";",
"}",
"// Collect child items",
"if",
"(",
"item",
".",
"items",
")",
"{",
"collect",
"(",
"item",
".",
"items",
"(",
")",
",",
"selector",
",",
"index",
")",
";",
"}",
"}",
"}",
"if",
"(",
"container",
".",
"items",
")",
"{",
"for",
"(",
"i",
"=",
"0",
",",
"l",
"=",
"selectors",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"collect",
"(",
"container",
".",
"items",
"(",
")",
",",
"selectors",
"[",
"i",
"]",
",",
"0",
")",
";",
"}",
"// Unique the matches if needed",
"if",
"(",
"l",
">",
"1",
")",
"{",
"matches",
"=",
"unique",
"(",
"matches",
")",
";",
"}",
"}",
"// Fix for circular reference",
"if",
"(",
"!",
"Collection",
")",
"{",
"// TODO: Fix me!",
"Collection",
"=",
"Selector",
".",
"Collection",
";",
"}",
"return",
"new",
"Collection",
"(",
"matches",
")",
";",
"}"
] | Returns a tinymce.ui.Collection with matches of the specified selector inside the specified container.
@method find
@param {tinymce.ui.Control} container Container to look for items in.
@return {tinymce.ui.Collection} Collection with matched elements. | [
"Returns",
"a",
"tinymce",
".",
"ui",
".",
"Collection",
"with",
"matches",
"of",
"the",
"specified",
"selector",
"inside",
"the",
"specified",
"container",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L25935-L25992 |
|
48,227 | sadiqhabib/tinymce-dist | tinymce.full.js | function (items) {
var self = this;
// Force single item into array
if (!Tools.isArray(items)) {
if (items instanceof Collection) {
self.add(items.toArray());
} else {
push.call(self, items);
}
} else {
push.apply(self, items);
}
return self;
} | javascript | function (items) {
var self = this;
// Force single item into array
if (!Tools.isArray(items)) {
if (items instanceof Collection) {
self.add(items.toArray());
} else {
push.call(self, items);
}
} else {
push.apply(self, items);
}
return self;
} | [
"function",
"(",
"items",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// Force single item into array",
"if",
"(",
"!",
"Tools",
".",
"isArray",
"(",
"items",
")",
")",
"{",
"if",
"(",
"items",
"instanceof",
"Collection",
")",
"{",
"self",
".",
"add",
"(",
"items",
".",
"toArray",
"(",
")",
")",
";",
"}",
"else",
"{",
"push",
".",
"call",
"(",
"self",
",",
"items",
")",
";",
"}",
"}",
"else",
"{",
"push",
".",
"apply",
"(",
"self",
",",
"items",
")",
";",
"}",
"return",
"self",
";",
"}"
] | Adds new items to the control collection.
@method add
@param {Array} items Array if items to add to collection.
@return {tinymce.ui.Collection} Current collection instance. | [
"Adds",
"new",
"items",
"to",
"the",
"control",
"collection",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L26059-L26074 |
|
48,228 | sadiqhabib/tinymce-dist | tinymce.full.js | function (items) {
var self = this, len = self.length, i;
self.length = 0;
self.add(items);
// Remove old entries
for (i = self.length; i < len; i++) {
delete self[i];
}
return self;
} | javascript | function (items) {
var self = this, len = self.length, i;
self.length = 0;
self.add(items);
// Remove old entries
for (i = self.length; i < len; i++) {
delete self[i];
}
return self;
} | [
"function",
"(",
"items",
")",
"{",
"var",
"self",
"=",
"this",
",",
"len",
"=",
"self",
".",
"length",
",",
"i",
";",
"self",
".",
"length",
"=",
"0",
";",
"self",
".",
"add",
"(",
"items",
")",
";",
"// Remove old entries",
"for",
"(",
"i",
"=",
"self",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"delete",
"self",
"[",
"i",
"]",
";",
"}",
"return",
"self",
";",
"}"
] | Sets the contents of the collection. This will remove any existing items
and replace them with the ones specified in the input array.
@method set
@param {Array} items Array with items to set into the Collection.
@return {tinymce.ui.Collection} Collection instance. | [
"Sets",
"the",
"contents",
"of",
"the",
"collection",
".",
"This",
"will",
"remove",
"any",
"existing",
"items",
"and",
"replace",
"them",
"with",
"the",
"ones",
"specified",
"in",
"the",
"input",
"array",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L26084-L26096 |
|
48,229 | sadiqhabib/tinymce-dist | tinymce.full.js | function (selector) {
var self = this, i, l, matches = [], item, match;
// Compile string into selector expression
if (typeof selector === "string") {
selector = new Selector(selector);
match = function (item) {
return selector.match(item);
};
} else {
// Use selector as matching function
match = selector;
}
for (i = 0, l = self.length; i < l; i++) {
item = self[i];
if (match(item)) {
matches.push(item);
}
}
return new Collection(matches);
} | javascript | function (selector) {
var self = this, i, l, matches = [], item, match;
// Compile string into selector expression
if (typeof selector === "string") {
selector = new Selector(selector);
match = function (item) {
return selector.match(item);
};
} else {
// Use selector as matching function
match = selector;
}
for (i = 0, l = self.length; i < l; i++) {
item = self[i];
if (match(item)) {
matches.push(item);
}
}
return new Collection(matches);
} | [
"function",
"(",
"selector",
")",
"{",
"var",
"self",
"=",
"this",
",",
"i",
",",
"l",
",",
"matches",
"=",
"[",
"]",
",",
"item",
",",
"match",
";",
"// Compile string into selector expression",
"if",
"(",
"typeof",
"selector",
"===",
"\"string\"",
")",
"{",
"selector",
"=",
"new",
"Selector",
"(",
"selector",
")",
";",
"match",
"=",
"function",
"(",
"item",
")",
"{",
"return",
"selector",
".",
"match",
"(",
"item",
")",
";",
"}",
";",
"}",
"else",
"{",
"// Use selector as matching function",
"match",
"=",
"selector",
";",
"}",
"for",
"(",
"i",
"=",
"0",
",",
"l",
"=",
"self",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"item",
"=",
"self",
"[",
"i",
"]",
";",
"if",
"(",
"match",
"(",
"item",
")",
")",
"{",
"matches",
".",
"push",
"(",
"item",
")",
";",
"}",
"}",
"return",
"new",
"Collection",
"(",
"matches",
")",
";",
"}"
] | Filters the collection item based on the specified selector expression or selector function.
@method filter
@param {String} selector Selector expression to filter items by.
@return {tinymce.ui.Collection} Collection containing the filtered items. | [
"Filters",
"the",
"collection",
"item",
"based",
"on",
"the",
"specified",
"selector",
"expression",
"or",
"selector",
"function",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L26105-L26129 |
|
48,230 | sadiqhabib/tinymce-dist | tinymce.full.js | function (ctrl) {
var self = this, i = self.length;
while (i--) {
if (self[i] === ctrl) {
break;
}
}
return i;
} | javascript | function (ctrl) {
var self = this, i = self.length;
while (i--) {
if (self[i] === ctrl) {
break;
}
}
return i;
} | [
"function",
"(",
"ctrl",
")",
"{",
"var",
"self",
"=",
"this",
",",
"i",
"=",
"self",
".",
"length",
";",
"while",
"(",
"i",
"--",
")",
"{",
"if",
"(",
"self",
"[",
"i",
"]",
"===",
"ctrl",
")",
"{",
"break",
";",
"}",
"}",
"return",
"i",
";",
"}"
] | Finds the index of the specified control or return -1 if it isn't in the collection.
@method indexOf
@param {Control} ctrl Control instance to look for.
@return {Number} Index of the specified control or -1. | [
"Finds",
"the",
"index",
"of",
"the",
"specified",
"control",
"or",
"return",
"-",
"1",
"if",
"it",
"isn",
"t",
"in",
"the",
"collection",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L26184-L26194 |
|
48,231 | sadiqhabib/tinymce-dist | tinymce.full.js | function (name) {
var self = this, args = Tools.toArray(arguments).slice(1);
self.each(function (item) {
if (item[name]) {
item[name].apply(item, args);
}
});
return self;
} | javascript | function (name) {
var self = this, args = Tools.toArray(arguments).slice(1);
self.each(function (item) {
if (item[name]) {
item[name].apply(item, args);
}
});
return self;
} | [
"function",
"(",
"name",
")",
"{",
"var",
"self",
"=",
"this",
",",
"args",
"=",
"Tools",
".",
"toArray",
"(",
"arguments",
")",
".",
"slice",
"(",
"1",
")",
";",
"self",
".",
"each",
"(",
"function",
"(",
"item",
")",
"{",
"if",
"(",
"item",
"[",
"name",
"]",
")",
"{",
"item",
"[",
"name",
"]",
".",
"apply",
"(",
"item",
",",
"args",
")",
";",
"}",
"}",
")",
";",
"return",
"self",
";",
"}"
] | Executes the specific function name with optional arguments an all items in collection if it exists.
@example collection.exec("myMethod", arg1, arg2, arg3);
@method exec
@param {String} name Name of the function to execute.
@param {Object} ... Multiple arguments to pass to each function.
@return {tinymce.ui.Collection} Current collection. | [
"Executes",
"the",
"specific",
"function",
"name",
"with",
"optional",
"arguments",
"an",
"all",
"items",
"in",
"collection",
"if",
"it",
"exists",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L26254-L26264 |
|
48,232 | sadiqhabib/tinymce-dist | tinymce.full.js | function (value) {
var len, radix = 10;
if (!value) {
return;
}
if (typeof value === "number") {
value = value || 0;
return {
top: value,
left: value,
bottom: value,
right: value
};
}
value = value.split(' ');
len = value.length;
if (len === 1) {
value[1] = value[2] = value[3] = value[0];
} else if (len === 2) {
value[2] = value[0];
value[3] = value[1];
} else if (len === 3) {
value[3] = value[1];
}
return {
top: parseInt(value[0], radix) || 0,
right: parseInt(value[1], radix) || 0,
bottom: parseInt(value[2], radix) || 0,
left: parseInt(value[3], radix) || 0
};
} | javascript | function (value) {
var len, radix = 10;
if (!value) {
return;
}
if (typeof value === "number") {
value = value || 0;
return {
top: value,
left: value,
bottom: value,
right: value
};
}
value = value.split(' ');
len = value.length;
if (len === 1) {
value[1] = value[2] = value[3] = value[0];
} else if (len === 2) {
value[2] = value[0];
value[3] = value[1];
} else if (len === 3) {
value[3] = value[1];
}
return {
top: parseInt(value[0], radix) || 0,
right: parseInt(value[1], radix) || 0,
bottom: parseInt(value[2], radix) || 0,
left: parseInt(value[3], radix) || 0
};
} | [
"function",
"(",
"value",
")",
"{",
"var",
"len",
",",
"radix",
"=",
"10",
";",
"if",
"(",
"!",
"value",
")",
"{",
"return",
";",
"}",
"if",
"(",
"typeof",
"value",
"===",
"\"number\"",
")",
"{",
"value",
"=",
"value",
"||",
"0",
";",
"return",
"{",
"top",
":",
"value",
",",
"left",
":",
"value",
",",
"bottom",
":",
"value",
",",
"right",
":",
"value",
"}",
";",
"}",
"value",
"=",
"value",
".",
"split",
"(",
"' '",
")",
";",
"len",
"=",
"value",
".",
"length",
";",
"if",
"(",
"len",
"===",
"1",
")",
"{",
"value",
"[",
"1",
"]",
"=",
"value",
"[",
"2",
"]",
"=",
"value",
"[",
"3",
"]",
"=",
"value",
"[",
"0",
"]",
";",
"}",
"else",
"if",
"(",
"len",
"===",
"2",
")",
"{",
"value",
"[",
"2",
"]",
"=",
"value",
"[",
"0",
"]",
";",
"value",
"[",
"3",
"]",
"=",
"value",
"[",
"1",
"]",
";",
"}",
"else",
"if",
"(",
"len",
"===",
"3",
")",
"{",
"value",
"[",
"3",
"]",
"=",
"value",
"[",
"1",
"]",
";",
"}",
"return",
"{",
"top",
":",
"parseInt",
"(",
"value",
"[",
"0",
"]",
",",
"radix",
")",
"||",
"0",
",",
"right",
":",
"parseInt",
"(",
"value",
"[",
"1",
"]",
",",
"radix",
")",
"||",
"0",
",",
"bottom",
":",
"parseInt",
"(",
"value",
"[",
"2",
"]",
",",
"radix",
")",
"||",
"0",
",",
"left",
":",
"parseInt",
"(",
"value",
"[",
"3",
"]",
",",
"radix",
")",
"||",
"0",
"}",
";",
"}"
] | Parses the specified box value. A box value contains 1-4 properties in clockwise order.
@method parseBox
@param {String/Number} value Box value "0 1 2 3" or "0" etc.
@return {Object} Object with top/right/bottom/left properties.
@private | [
"Parses",
"the",
"specified",
"box",
"value",
".",
"A",
"box",
"value",
"contains",
"1",
"-",
"4",
"properties",
"in",
"clockwise",
"order",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L26609-L26645 |
|
48,233 | sadiqhabib/tinymce-dist | tinymce.full.js | function (cls) {
if (cls && !this.contains(cls)) {
this.cls._map[cls] = true;
this.cls.push(cls);
this._change();
}
return this;
} | javascript | function (cls) {
if (cls && !this.contains(cls)) {
this.cls._map[cls] = true;
this.cls.push(cls);
this._change();
}
return this;
} | [
"function",
"(",
"cls",
")",
"{",
"if",
"(",
"cls",
"&&",
"!",
"this",
".",
"contains",
"(",
"cls",
")",
")",
"{",
"this",
".",
"cls",
".",
"_map",
"[",
"cls",
"]",
"=",
"true",
";",
"this",
".",
"cls",
".",
"push",
"(",
"cls",
")",
";",
"this",
".",
"_change",
"(",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Adds a new class to the class list.
@method add
@param {String} cls Class to be added.
@return {tinymce.ui.ClassList} Current class list instance. | [
"Adds",
"a",
"new",
"class",
"to",
"the",
"class",
"list",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L26729-L26737 |
|
48,234 | sadiqhabib/tinymce-dist | tinymce.full.js | function (cls) {
if (this.contains(cls)) {
for (var i = 0; i < this.cls.length; i++) {
if (this.cls[i] === cls) {
break;
}
}
this.cls.splice(i, 1);
delete this.cls._map[cls];
this._change();
}
return this;
} | javascript | function (cls) {
if (this.contains(cls)) {
for (var i = 0; i < this.cls.length; i++) {
if (this.cls[i] === cls) {
break;
}
}
this.cls.splice(i, 1);
delete this.cls._map[cls];
this._change();
}
return this;
} | [
"function",
"(",
"cls",
")",
"{",
"if",
"(",
"this",
".",
"contains",
"(",
"cls",
")",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"cls",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"this",
".",
"cls",
"[",
"i",
"]",
"===",
"cls",
")",
"{",
"break",
";",
"}",
"}",
"this",
".",
"cls",
".",
"splice",
"(",
"i",
",",
"1",
")",
";",
"delete",
"this",
".",
"cls",
".",
"_map",
"[",
"cls",
"]",
";",
"this",
".",
"_change",
"(",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Removes the specified class from the class list.
@method remove
@param {String} cls Class to be removed.
@return {tinymce.ui.ClassList} Current class list instance. | [
"Removes",
"the",
"specified",
"class",
"from",
"the",
"class",
"list",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L26746-L26760 |
|
48,235 | sadiqhabib/tinymce-dist | tinymce.full.js | function (cls, state) {
var curState = this.contains(cls);
if (curState !== state) {
if (curState) {
this.remove(cls);
} else {
this.add(cls);
}
this._change();
}
return this;
} | javascript | function (cls, state) {
var curState = this.contains(cls);
if (curState !== state) {
if (curState) {
this.remove(cls);
} else {
this.add(cls);
}
this._change();
}
return this;
} | [
"function",
"(",
"cls",
",",
"state",
")",
"{",
"var",
"curState",
"=",
"this",
".",
"contains",
"(",
"cls",
")",
";",
"if",
"(",
"curState",
"!==",
"state",
")",
"{",
"if",
"(",
"curState",
")",
"{",
"this",
".",
"remove",
"(",
"cls",
")",
";",
"}",
"else",
"{",
"this",
".",
"add",
"(",
"cls",
")",
";",
"}",
"this",
".",
"_change",
"(",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Toggles a class in the class list.
@method toggle
@param {String} cls Class to be added/removed.
@param {Boolean} state Optional state if it should be added/removed.
@return {tinymce.ui.ClassList} Current class list instance. | [
"Toggles",
"a",
"class",
"in",
"the",
"class",
"list",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L26770-L26784 |
|
48,236 | sadiqhabib/tinymce-dist | tinymce.full.js | function (elm) {
var ctrl, lookup = this.getRoot().controlIdLookup;
while (elm && lookup) {
ctrl = lookup[elm.id];
if (ctrl) {
break;
}
elm = elm.parentNode;
}
return ctrl;
} | javascript | function (elm) {
var ctrl, lookup = this.getRoot().controlIdLookup;
while (elm && lookup) {
ctrl = lookup[elm.id];
if (ctrl) {
break;
}
elm = elm.parentNode;
}
return ctrl;
} | [
"function",
"(",
"elm",
")",
"{",
"var",
"ctrl",
",",
"lookup",
"=",
"this",
".",
"getRoot",
"(",
")",
".",
"controlIdLookup",
";",
"while",
"(",
"elm",
"&&",
"lookup",
")",
"{",
"ctrl",
"=",
"lookup",
"[",
"elm",
".",
"id",
"]",
";",
"if",
"(",
"ctrl",
")",
"{",
"break",
";",
"}",
"elm",
"=",
"elm",
".",
"parentNode",
";",
"}",
"return",
"ctrl",
";",
"}"
] | Returns a control instance for the current DOM element.
@method getParentCtrl
@param {Element} elm HTML dom element to get parent control from.
@return {tinymce.ui.Control} Control instance or undefined. | [
"Returns",
"a",
"control",
"instance",
"for",
"the",
"current",
"DOM",
"element",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L27089-L27102 |
|
48,237 | sadiqhabib/tinymce-dist | tinymce.full.js | function () {
var self = this;
self.parent()._lastRect = null;
DomUtils.css(self.getEl(), { width: '', height: '' });
self._layoutRect = self._lastRepaintRect = self._lastLayoutRect = null;
self.initLayoutRect();
} | javascript | function () {
var self = this;
self.parent()._lastRect = null;
DomUtils.css(self.getEl(), { width: '', height: '' });
self._layoutRect = self._lastRepaintRect = self._lastLayoutRect = null;
self.initLayoutRect();
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"parent",
"(",
")",
".",
"_lastRect",
"=",
"null",
";",
"DomUtils",
".",
"css",
"(",
"self",
".",
"getEl",
"(",
")",
",",
"{",
"width",
":",
"''",
",",
"height",
":",
"''",
"}",
")",
";",
"self",
".",
"_layoutRect",
"=",
"self",
".",
"_lastRepaintRect",
"=",
"self",
".",
"_lastLayoutRect",
"=",
"null",
";",
"self",
".",
"initLayoutRect",
"(",
")",
";",
"}"
] | Updates the controls layout rect by re-measuing it. | [
"Updates",
"the",
"controls",
"layout",
"rect",
"by",
"re",
"-",
"measuing",
"it",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L27357-L27366 |
|
48,238 | sadiqhabib/tinymce-dist | tinymce.full.js | function (name, callback) {
var self = this;
function resolveCallbackName(name) {
var callback, scope;
if (typeof name != 'string') {
return name;
}
return function (e) {
if (!callback) {
self.parentsAndSelf().each(function (ctrl) {
var callbacks = ctrl.settings.callbacks;
if (callbacks && (callback = callbacks[name])) {
scope = ctrl;
return false;
}
});
}
if (!callback) {
e.action = name;
this.fire('execute', e);
return;
}
return callback.call(scope, e);
};
}
getEventDispatcher(self).on(name, resolveCallbackName(callback));
return self;
} | javascript | function (name, callback) {
var self = this;
function resolveCallbackName(name) {
var callback, scope;
if (typeof name != 'string') {
return name;
}
return function (e) {
if (!callback) {
self.parentsAndSelf().each(function (ctrl) {
var callbacks = ctrl.settings.callbacks;
if (callbacks && (callback = callbacks[name])) {
scope = ctrl;
return false;
}
});
}
if (!callback) {
e.action = name;
this.fire('execute', e);
return;
}
return callback.call(scope, e);
};
}
getEventDispatcher(self).on(name, resolveCallbackName(callback));
return self;
} | [
"function",
"(",
"name",
",",
"callback",
")",
"{",
"var",
"self",
"=",
"this",
";",
"function",
"resolveCallbackName",
"(",
"name",
")",
"{",
"var",
"callback",
",",
"scope",
";",
"if",
"(",
"typeof",
"name",
"!=",
"'string'",
")",
"{",
"return",
"name",
";",
"}",
"return",
"function",
"(",
"e",
")",
"{",
"if",
"(",
"!",
"callback",
")",
"{",
"self",
".",
"parentsAndSelf",
"(",
")",
".",
"each",
"(",
"function",
"(",
"ctrl",
")",
"{",
"var",
"callbacks",
"=",
"ctrl",
".",
"settings",
".",
"callbacks",
";",
"if",
"(",
"callbacks",
"&&",
"(",
"callback",
"=",
"callbacks",
"[",
"name",
"]",
")",
")",
"{",
"scope",
"=",
"ctrl",
";",
"return",
"false",
";",
"}",
"}",
")",
";",
"}",
"if",
"(",
"!",
"callback",
")",
"{",
"e",
".",
"action",
"=",
"name",
";",
"this",
".",
"fire",
"(",
"'execute'",
",",
"e",
")",
";",
"return",
";",
"}",
"return",
"callback",
".",
"call",
"(",
"scope",
",",
"e",
")",
";",
"}",
";",
"}",
"getEventDispatcher",
"(",
"self",
")",
".",
"on",
"(",
"name",
",",
"resolveCallbackName",
"(",
"callback",
")",
")",
";",
"return",
"self",
";",
"}"
] | Binds a callback to the specified event. This event can both be
native browser events like "click" or custom ones like PostRender.
The callback function will be passed a DOM event like object that enables yout do stop propagation.
@method on
@param {String} name Name of the event to bind. For example "click".
@param {String/function} callback Callback function to execute ones the event occurs.
@return {tinymce.ui.Control} Current control object. | [
"Binds",
"a",
"callback",
"to",
"the",
"specified",
"event",
".",
"This",
"event",
"can",
"both",
"be",
"native",
"browser",
"events",
"like",
"click",
"or",
"custom",
"ones",
"like",
"PostRender",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L27379-L27414 |
|
48,239 | sadiqhabib/tinymce-dist | tinymce.full.js | function (selector) {
var self = this, ctrl, parents = new Collection();
// Add each parent to collection
for (ctrl = self.parent(); ctrl; ctrl = ctrl.parent()) {
parents.add(ctrl);
}
// Filter away everything that doesn't match the selector
if (selector) {
parents = parents.filter(selector);
}
return parents;
} | javascript | function (selector) {
var self = this, ctrl, parents = new Collection();
// Add each parent to collection
for (ctrl = self.parent(); ctrl; ctrl = ctrl.parent()) {
parents.add(ctrl);
}
// Filter away everything that doesn't match the selector
if (selector) {
parents = parents.filter(selector);
}
return parents;
} | [
"function",
"(",
"selector",
")",
"{",
"var",
"self",
"=",
"this",
",",
"ctrl",
",",
"parents",
"=",
"new",
"Collection",
"(",
")",
";",
"// Add each parent to collection",
"for",
"(",
"ctrl",
"=",
"self",
".",
"parent",
"(",
")",
";",
"ctrl",
";",
"ctrl",
"=",
"ctrl",
".",
"parent",
"(",
")",
")",
"{",
"parents",
".",
"add",
"(",
"ctrl",
")",
";",
"}",
"// Filter away everything that doesn't match the selector",
"if",
"(",
"selector",
")",
"{",
"parents",
"=",
"parents",
".",
"filter",
"(",
"selector",
")",
";",
"}",
"return",
"parents",
";",
"}"
] | Returns a control collection with all parent controls.
@method parents
@param {String} selector Optional selector expression to find parents.
@return {tinymce.ui.Collection} Collection with all parent controls. | [
"Returns",
"a",
"control",
"collection",
"with",
"all",
"parent",
"controls",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L27482-L27496 |
|
48,240 | sadiqhabib/tinymce-dist | tinymce.full.js | function (suffix) {
var id = suffix ? this._id + '-' + suffix : this._id;
if (!this._elmCache[id]) {
this._elmCache[id] = $('#' + id)[0];
}
return this._elmCache[id];
} | javascript | function (suffix) {
var id = suffix ? this._id + '-' + suffix : this._id;
if (!this._elmCache[id]) {
this._elmCache[id] = $('#' + id)[0];
}
return this._elmCache[id];
} | [
"function",
"(",
"suffix",
")",
"{",
"var",
"id",
"=",
"suffix",
"?",
"this",
".",
"_id",
"+",
"'-'",
"+",
"suffix",
":",
"this",
".",
"_id",
";",
"if",
"(",
"!",
"this",
".",
"_elmCache",
"[",
"id",
"]",
")",
"{",
"this",
".",
"_elmCache",
"[",
"id",
"]",
"=",
"$",
"(",
"'#'",
"+",
"id",
")",
"[",
"0",
"]",
";",
"}",
"return",
"this",
".",
"_elmCache",
"[",
"id",
"]",
";",
"}"
] | Returns the control DOM element or sub element.
@method getEl
@param {String} [suffix] Suffix to get element by.
@return {Element} HTML DOM element for the current control or it's children. | [
"Returns",
"the",
"control",
"DOM",
"element",
"or",
"sub",
"element",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L27552-L27560 |
|
48,241 | sadiqhabib/tinymce-dist | tinymce.full.js | function (name, value) {
var self = this, elm = self.getEl(self.ariaTarget);
if (typeof value === "undefined") {
return self._aria[name];
}
self._aria[name] = value;
if (self.state.get('rendered')) {
elm.setAttribute(name == 'role' ? name : 'aria-' + name, value);
}
return self;
} | javascript | function (name, value) {
var self = this, elm = self.getEl(self.ariaTarget);
if (typeof value === "undefined") {
return self._aria[name];
}
self._aria[name] = value;
if (self.state.get('rendered')) {
elm.setAttribute(name == 'role' ? name : 'aria-' + name, value);
}
return self;
} | [
"function",
"(",
"name",
",",
"value",
")",
"{",
"var",
"self",
"=",
"this",
",",
"elm",
"=",
"self",
".",
"getEl",
"(",
"self",
".",
"ariaTarget",
")",
";",
"if",
"(",
"typeof",
"value",
"===",
"\"undefined\"",
")",
"{",
"return",
"self",
".",
"_aria",
"[",
"name",
"]",
";",
"}",
"self",
".",
"_aria",
"[",
"name",
"]",
"=",
"value",
";",
"if",
"(",
"self",
".",
"state",
".",
"get",
"(",
"'rendered'",
")",
")",
"{",
"elm",
".",
"setAttribute",
"(",
"name",
"==",
"'role'",
"?",
"name",
":",
"'aria-'",
"+",
"name",
",",
"value",
")",
";",
"}",
"return",
"self",
";",
"}"
] | Sets the specified aria property.
@method aria
@param {String} name Name of the aria property to set.
@param {String} value Value of the aria property.
@return {tinymce.ui.Control} Current control instance. | [
"Sets",
"the",
"specified",
"aria",
"property",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L27618-L27632 |
|
48,242 | sadiqhabib/tinymce-dist | tinymce.full.js | function (text, translate) {
if (translate !== false) {
text = this.translate(text);
}
return (text || '').replace(/[&<>"]/g, function (match) {
return '&#' + match.charCodeAt(0) + ';';
});
} | javascript | function (text, translate) {
if (translate !== false) {
text = this.translate(text);
}
return (text || '').replace(/[&<>"]/g, function (match) {
return '&#' + match.charCodeAt(0) + ';';
});
} | [
"function",
"(",
"text",
",",
"translate",
")",
"{",
"if",
"(",
"translate",
"!==",
"false",
")",
"{",
"text",
"=",
"this",
".",
"translate",
"(",
"text",
")",
";",
"}",
"return",
"(",
"text",
"||",
"''",
")",
".",
"replace",
"(",
"/",
"[&<>\"]",
"/",
"g",
",",
"function",
"(",
"match",
")",
"{",
"return",
"'&#'",
"+",
"match",
".",
"charCodeAt",
"(",
"0",
")",
"+",
"';'",
";",
"}",
")",
";",
"}"
] | Encodes the specified string with HTML entities. It will also
translate the string to different languages.
@method encode
@param {String/Object/Array} text Text to entity encode.
@param {Boolean} [translate=true] False if the contents shouldn't be translated.
@return {String} Encoded and possible traslated string. | [
"Encodes",
"the",
"specified",
"string",
"with",
"HTML",
"entities",
".",
"It",
"will",
"also",
"translate",
"the",
"string",
"to",
"different",
"languages",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L27643-L27651 |
|
48,243 | sadiqhabib/tinymce-dist | tinymce.full.js | function (items) {
var self = this, parent = self.parent();
if (parent) {
parent.insert(items, parent.items().indexOf(self), true);
}
return self;
} | javascript | function (items) {
var self = this, parent = self.parent();
if (parent) {
parent.insert(items, parent.items().indexOf(self), true);
}
return self;
} | [
"function",
"(",
"items",
")",
"{",
"var",
"self",
"=",
"this",
",",
"parent",
"=",
"self",
".",
"parent",
"(",
")",
";",
"if",
"(",
"parent",
")",
"{",
"parent",
".",
"insert",
"(",
"items",
",",
"parent",
".",
"items",
"(",
")",
".",
"indexOf",
"(",
"self",
")",
",",
"true",
")",
";",
"}",
"return",
"self",
";",
"}"
] | Adds items before the current control.
@method before
@param {Array/tinymce.ui.Collection} items Array of items to prepend before this control.
@return {tinymce.ui.Control} Current control instance. | [
"Adds",
"items",
"before",
"the",
"current",
"control",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L27671-L27679 |
|
48,244 | sadiqhabib/tinymce-dist | tinymce.full.js | function (align) {
function getOffset(elm, rootElm) {
var x, y, parent = elm;
x = y = 0;
while (parent && parent != rootElm && parent.nodeType) {
x += parent.offsetLeft || 0;
y += parent.offsetTop || 0;
parent = parent.offsetParent;
}
return { x: x, y: y };
}
var elm = this.getEl(), parentElm = elm.parentNode;
var x, y, width, height, parentWidth, parentHeight;
var pos = getOffset(elm, parentElm);
x = pos.x;
y = pos.y;
width = elm.offsetWidth;
height = elm.offsetHeight;
parentWidth = parentElm.clientWidth;
parentHeight = parentElm.clientHeight;
if (align == "end") {
x -= parentWidth - width;
y -= parentHeight - height;
} else if (align == "center") {
x -= (parentWidth / 2) - (width / 2);
y -= (parentHeight / 2) - (height / 2);
}
parentElm.scrollLeft = x;
parentElm.scrollTop = y;
return this;
} | javascript | function (align) {
function getOffset(elm, rootElm) {
var x, y, parent = elm;
x = y = 0;
while (parent && parent != rootElm && parent.nodeType) {
x += parent.offsetLeft || 0;
y += parent.offsetTop || 0;
parent = parent.offsetParent;
}
return { x: x, y: y };
}
var elm = this.getEl(), parentElm = elm.parentNode;
var x, y, width, height, parentWidth, parentHeight;
var pos = getOffset(elm, parentElm);
x = pos.x;
y = pos.y;
width = elm.offsetWidth;
height = elm.offsetHeight;
parentWidth = parentElm.clientWidth;
parentHeight = parentElm.clientHeight;
if (align == "end") {
x -= parentWidth - width;
y -= parentHeight - height;
} else if (align == "center") {
x -= (parentWidth / 2) - (width / 2);
y -= (parentHeight / 2) - (height / 2);
}
parentElm.scrollLeft = x;
parentElm.scrollTop = y;
return this;
} | [
"function",
"(",
"align",
")",
"{",
"function",
"getOffset",
"(",
"elm",
",",
"rootElm",
")",
"{",
"var",
"x",
",",
"y",
",",
"parent",
"=",
"elm",
";",
"x",
"=",
"y",
"=",
"0",
";",
"while",
"(",
"parent",
"&&",
"parent",
"!=",
"rootElm",
"&&",
"parent",
".",
"nodeType",
")",
"{",
"x",
"+=",
"parent",
".",
"offsetLeft",
"||",
"0",
";",
"y",
"+=",
"parent",
".",
"offsetTop",
"||",
"0",
";",
"parent",
"=",
"parent",
".",
"offsetParent",
";",
"}",
"return",
"{",
"x",
":",
"x",
",",
"y",
":",
"y",
"}",
";",
"}",
"var",
"elm",
"=",
"this",
".",
"getEl",
"(",
")",
",",
"parentElm",
"=",
"elm",
".",
"parentNode",
";",
"var",
"x",
",",
"y",
",",
"width",
",",
"height",
",",
"parentWidth",
",",
"parentHeight",
";",
"var",
"pos",
"=",
"getOffset",
"(",
"elm",
",",
"parentElm",
")",
";",
"x",
"=",
"pos",
".",
"x",
";",
"y",
"=",
"pos",
".",
"y",
";",
"width",
"=",
"elm",
".",
"offsetWidth",
";",
"height",
"=",
"elm",
".",
"offsetHeight",
";",
"parentWidth",
"=",
"parentElm",
".",
"clientWidth",
";",
"parentHeight",
"=",
"parentElm",
".",
"clientHeight",
";",
"if",
"(",
"align",
"==",
"\"end\"",
")",
"{",
"x",
"-=",
"parentWidth",
"-",
"width",
";",
"y",
"-=",
"parentHeight",
"-",
"height",
";",
"}",
"else",
"if",
"(",
"align",
"==",
"\"center\"",
")",
"{",
"x",
"-=",
"(",
"parentWidth",
"/",
"2",
")",
"-",
"(",
"width",
"/",
"2",
")",
";",
"y",
"-=",
"(",
"parentHeight",
"/",
"2",
")",
"-",
"(",
"height",
"/",
"2",
")",
";",
"}",
"parentElm",
".",
"scrollLeft",
"=",
"x",
";",
"parentElm",
".",
"scrollTop",
"=",
"y",
";",
"return",
"this",
";",
"}"
] | Scrolls the current control into view.
@method scrollIntoView
@param {String} align Alignment in view top|center|bottom.
@return {tinymce.ui.Control} Current control instance. | [
"Scrolls",
"the",
"current",
"control",
"into",
"view",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L27888-L27925 |
|
48,245 | sadiqhabib/tinymce-dist | tinymce.full.js | function () {
ReflowQueue.remove(this);
var parent = this.parent();
if (parent._layout && !parent._layout.isNative()) {
parent.reflow();
}
return this;
} | javascript | function () {
ReflowQueue.remove(this);
var parent = this.parent();
if (parent._layout && !parent._layout.isNative()) {
parent.reflow();
}
return this;
} | [
"function",
"(",
")",
"{",
"ReflowQueue",
".",
"remove",
"(",
"this",
")",
";",
"var",
"parent",
"=",
"this",
".",
"parent",
"(",
")",
";",
"if",
"(",
"parent",
".",
"_layout",
"&&",
"!",
"parent",
".",
"_layout",
".",
"isNative",
"(",
")",
")",
"{",
"parent",
".",
"reflow",
"(",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Reflows the current control and it's parents.
This should be used after you for example append children to the current control so
that the layout managers know that they need to reposition everything.
@example
container.append({type: 'button', text: 'My button'}).reflow();
@method reflow
@return {tinymce.ui.Control} Current control instance. | [
"Reflows",
"the",
"current",
"control",
"and",
"it",
"s",
"parents",
".",
"This",
"should",
"be",
"used",
"after",
"you",
"for",
"example",
"append",
"children",
"to",
"the",
"current",
"control",
"so",
"that",
"the",
"layout",
"managers",
"know",
"that",
"they",
"need",
"to",
"reposition",
"everything",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L27964-L27973 |
|
48,246 | sadiqhabib/tinymce-dist | tinymce.full.js | function (type, settings) {
var ControlType;
// If string is specified then use it as the type
if (typeof type == 'string') {
settings = settings || {};
settings.type = type;
} else {
settings = type;
type = settings.type;
}
// Find control type
type = type.toLowerCase();
ControlType = types[type];
// #if debug
if (!ControlType) {
throw new Error("Could not find control by type: " + type);
}
// #endif
ControlType = new ControlType(settings);
ControlType.type = type; // Set the type on the instance, this will be used by the Selector engine
return ControlType;
} | javascript | function (type, settings) {
var ControlType;
// If string is specified then use it as the type
if (typeof type == 'string') {
settings = settings || {};
settings.type = type;
} else {
settings = type;
type = settings.type;
}
// Find control type
type = type.toLowerCase();
ControlType = types[type];
// #if debug
if (!ControlType) {
throw new Error("Could not find control by type: " + type);
}
// #endif
ControlType = new ControlType(settings);
ControlType.type = type; // Set the type on the instance, this will be used by the Selector engine
return ControlType;
} | [
"function",
"(",
"type",
",",
"settings",
")",
"{",
"var",
"ControlType",
";",
"// If string is specified then use it as the type",
"if",
"(",
"typeof",
"type",
"==",
"'string'",
")",
"{",
"settings",
"=",
"settings",
"||",
"{",
"}",
";",
"settings",
".",
"type",
"=",
"type",
";",
"}",
"else",
"{",
"settings",
"=",
"type",
";",
"type",
"=",
"settings",
".",
"type",
";",
"}",
"// Find control type",
"type",
"=",
"type",
".",
"toLowerCase",
"(",
")",
";",
"ControlType",
"=",
"types",
"[",
"type",
"]",
";",
"// #if debug",
"if",
"(",
"!",
"ControlType",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Could not find control by type: \"",
"+",
"type",
")",
";",
"}",
"// #endif",
"ControlType",
"=",
"new",
"ControlType",
"(",
"settings",
")",
";",
"ControlType",
".",
"type",
"=",
"type",
";",
"// Set the type on the instance, this will be used by the Selector engine",
"return",
"ControlType",
";",
"}"
] | Creates a new control instance based on the settings provided. The instance created will be
based on the specified type property it can also create whole structures of components out of
the specified JSON object.
@example
tinymce.ui.Factory.create({
type: 'button',
text: 'Hello world!'
});
@method create
@param {Object/String} settings Name/Value object with items used to create the type.
@return {tinymce.ui.Control} Control instance based on the specified type. | [
"Creates",
"a",
"new",
"control",
"instance",
"based",
"on",
"the",
"settings",
"provided",
".",
"The",
"instance",
"created",
"will",
"be",
"based",
"on",
"the",
"specified",
"type",
"property",
"it",
"can",
"also",
"create",
"whole",
"structures",
"of",
"components",
"out",
"of",
"the",
"specified",
"JSON",
"object",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L28288-L28316 |
|
48,247 | sadiqhabib/tinymce-dist | tinymce.full.js | getRole | function getRole(elm) {
elm = elm || focusedElement;
if (isElement(elm)) {
return elm.getAttribute('role');
}
return null;
} | javascript | function getRole(elm) {
elm = elm || focusedElement;
if (isElement(elm)) {
return elm.getAttribute('role');
}
return null;
} | [
"function",
"getRole",
"(",
"elm",
")",
"{",
"elm",
"=",
"elm",
"||",
"focusedElement",
";",
"if",
"(",
"isElement",
"(",
"elm",
")",
")",
"{",
"return",
"elm",
".",
"getAttribute",
"(",
"'role'",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Returns the currently focused elements wai aria role of the currently
focused element or specified element.
@private
@param {Element} elm Optional element to get role from.
@return {String} Role of specified element. | [
"Returns",
"the",
"currently",
"focused",
"elements",
"wai",
"aria",
"role",
"of",
"the",
"currently",
"focused",
"element",
"or",
"specified",
"element",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L28372-L28380 |
48,248 | sadiqhabib/tinymce-dist | tinymce.full.js | getParentRole | function getParentRole(elm) {
var role, parent = elm || focusedElement;
while ((parent = parent.parentNode)) {
if ((role = getRole(parent))) {
return role;
}
}
} | javascript | function getParentRole(elm) {
var role, parent = elm || focusedElement;
while ((parent = parent.parentNode)) {
if ((role = getRole(parent))) {
return role;
}
}
} | [
"function",
"getParentRole",
"(",
"elm",
")",
"{",
"var",
"role",
",",
"parent",
"=",
"elm",
"||",
"focusedElement",
";",
"while",
"(",
"(",
"parent",
"=",
"parent",
".",
"parentNode",
")",
")",
"{",
"if",
"(",
"(",
"role",
"=",
"getRole",
"(",
"parent",
")",
")",
")",
"{",
"return",
"role",
";",
"}",
"}",
"}"
] | Returns the wai role of the parent element of the currently
focused element or specified element.
@private
@param {Element} elm Optional element to get parent role from.
@return {String} Role of the first parent that has a role. | [
"Returns",
"the",
"wai",
"role",
"of",
"the",
"parent",
"element",
"of",
"the",
"currently",
"focused",
"element",
"or",
"specified",
"element",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L28390-L28398 |
48,249 | sadiqhabib/tinymce-dist | tinymce.full.js | getFocusElements | function getFocusElements(elm) {
var elements = [];
function collect(elm) {
if (elm.nodeType != 1 || elm.style.display == 'none' || elm.disabled) {
return;
}
if (canFocus(elm)) {
elements.push(elm);
}
for (var i = 0; i < elm.childNodes.length; i++) {
collect(elm.childNodes[i]);
}
}
collect(elm || root.getEl());
return elements;
} | javascript | function getFocusElements(elm) {
var elements = [];
function collect(elm) {
if (elm.nodeType != 1 || elm.style.display == 'none' || elm.disabled) {
return;
}
if (canFocus(elm)) {
elements.push(elm);
}
for (var i = 0; i < elm.childNodes.length; i++) {
collect(elm.childNodes[i]);
}
}
collect(elm || root.getEl());
return elements;
} | [
"function",
"getFocusElements",
"(",
"elm",
")",
"{",
"var",
"elements",
"=",
"[",
"]",
";",
"function",
"collect",
"(",
"elm",
")",
"{",
"if",
"(",
"elm",
".",
"nodeType",
"!=",
"1",
"||",
"elm",
".",
"style",
".",
"display",
"==",
"'none'",
"||",
"elm",
".",
"disabled",
")",
"{",
"return",
";",
"}",
"if",
"(",
"canFocus",
"(",
"elm",
")",
")",
"{",
"elements",
".",
"push",
"(",
"elm",
")",
";",
"}",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"elm",
".",
"childNodes",
".",
"length",
";",
"i",
"++",
")",
"{",
"collect",
"(",
"elm",
".",
"childNodes",
"[",
"i",
"]",
")",
";",
"}",
"}",
"collect",
"(",
"elm",
"||",
"root",
".",
"getEl",
"(",
")",
")",
";",
"return",
"elements",
";",
"}"
] | Returns an array of focusable visible elements within the specified container element.
@private
@param {Element} elm DOM element to find focusable elements within.
@return {Array} Array of focusable elements. | [
"Returns",
"an",
"array",
"of",
"focusable",
"visible",
"elements",
"within",
"the",
"specified",
"container",
"element",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L28456-L28476 |
48,250 | sadiqhabib/tinymce-dist | tinymce.full.js | getNavigationRoot | function getNavigationRoot(targetControl) {
var navigationRoot, controls;
targetControl = targetControl || focusedControl;
controls = targetControl.parents().toArray();
controls.unshift(targetControl);
for (var i = 0; i < controls.length; i++) {
navigationRoot = controls[i];
if (navigationRoot.settings.ariaRoot) {
break;
}
}
return navigationRoot;
} | javascript | function getNavigationRoot(targetControl) {
var navigationRoot, controls;
targetControl = targetControl || focusedControl;
controls = targetControl.parents().toArray();
controls.unshift(targetControl);
for (var i = 0; i < controls.length; i++) {
navigationRoot = controls[i];
if (navigationRoot.settings.ariaRoot) {
break;
}
}
return navigationRoot;
} | [
"function",
"getNavigationRoot",
"(",
"targetControl",
")",
"{",
"var",
"navigationRoot",
",",
"controls",
";",
"targetControl",
"=",
"targetControl",
"||",
"focusedControl",
";",
"controls",
"=",
"targetControl",
".",
"parents",
"(",
")",
".",
"toArray",
"(",
")",
";",
"controls",
".",
"unshift",
"(",
"targetControl",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"controls",
".",
"length",
";",
"i",
"++",
")",
"{",
"navigationRoot",
"=",
"controls",
"[",
"i",
"]",
";",
"if",
"(",
"navigationRoot",
".",
"settings",
".",
"ariaRoot",
")",
"{",
"break",
";",
"}",
"}",
"return",
"navigationRoot",
";",
"}"
] | Returns the navigation root control for the specified control. The navigation root
is the control that the keyboard navigation gets scoped to for example a menubar or toolbar group.
It will look for parents of the specified target control or the currently focused control if this option is omitted.
@private
@param {tinymce.ui.Control} targetControl Optional target control to find root of.
@return {tinymce.ui.Control} Navigation root control. | [
"Returns",
"the",
"navigation",
"root",
"control",
"for",
"the",
"specified",
"control",
".",
"The",
"navigation",
"root",
"is",
"the",
"control",
"that",
"the",
"keyboard",
"navigation",
"gets",
"scoped",
"to",
"for",
"example",
"a",
"menubar",
"or",
"toolbar",
"group",
".",
"It",
"will",
"look",
"for",
"parents",
"of",
"the",
"specified",
"target",
"control",
"or",
"the",
"currently",
"focused",
"control",
"if",
"this",
"option",
"is",
"omitted",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L28487-L28503 |
48,251 | sadiqhabib/tinymce-dist | tinymce.full.js | focusFirst | function focusFirst(targetControl) {
var navigationRoot = getNavigationRoot(targetControl);
var focusElements = getFocusElements(navigationRoot.getEl());
if (navigationRoot.settings.ariaRemember && "lastAriaIndex" in navigationRoot) {
moveFocusToIndex(navigationRoot.lastAriaIndex, focusElements);
} else {
moveFocusToIndex(0, focusElements);
}
} | javascript | function focusFirst(targetControl) {
var navigationRoot = getNavigationRoot(targetControl);
var focusElements = getFocusElements(navigationRoot.getEl());
if (navigationRoot.settings.ariaRemember && "lastAriaIndex" in navigationRoot) {
moveFocusToIndex(navigationRoot.lastAriaIndex, focusElements);
} else {
moveFocusToIndex(0, focusElements);
}
} | [
"function",
"focusFirst",
"(",
"targetControl",
")",
"{",
"var",
"navigationRoot",
"=",
"getNavigationRoot",
"(",
"targetControl",
")",
";",
"var",
"focusElements",
"=",
"getFocusElements",
"(",
"navigationRoot",
".",
"getEl",
"(",
")",
")",
";",
"if",
"(",
"navigationRoot",
".",
"settings",
".",
"ariaRemember",
"&&",
"\"lastAriaIndex\"",
"in",
"navigationRoot",
")",
"{",
"moveFocusToIndex",
"(",
"navigationRoot",
".",
"lastAriaIndex",
",",
"focusElements",
")",
";",
"}",
"else",
"{",
"moveFocusToIndex",
"(",
"0",
",",
"focusElements",
")",
";",
"}",
"}"
] | Focuses the first item in the specified targetControl element or the last aria index if the
navigation root has the ariaRemember option enabled.
@private
@param {tinymce.ui.Control} targetControl Target control to focus the first item in. | [
"Focuses",
"the",
"first",
"item",
"in",
"the",
"specified",
"targetControl",
"element",
"or",
"the",
"last",
"aria",
"index",
"if",
"the",
"navigation",
"root",
"has",
"the",
"ariaRemember",
"option",
"enabled",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L28512-L28521 |
48,252 | sadiqhabib/tinymce-dist | tinymce.full.js | moveFocusToIndex | function moveFocusToIndex(idx, elements) {
if (idx < 0) {
idx = elements.length - 1;
} else if (idx >= elements.length) {
idx = 0;
}
if (elements[idx]) {
elements[idx].focus();
}
return idx;
} | javascript | function moveFocusToIndex(idx, elements) {
if (idx < 0) {
idx = elements.length - 1;
} else if (idx >= elements.length) {
idx = 0;
}
if (elements[idx]) {
elements[idx].focus();
}
return idx;
} | [
"function",
"moveFocusToIndex",
"(",
"idx",
",",
"elements",
")",
"{",
"if",
"(",
"idx",
"<",
"0",
")",
"{",
"idx",
"=",
"elements",
".",
"length",
"-",
"1",
";",
"}",
"else",
"if",
"(",
"idx",
">=",
"elements",
".",
"length",
")",
"{",
"idx",
"=",
"0",
";",
"}",
"if",
"(",
"elements",
"[",
"idx",
"]",
")",
"{",
"elements",
"[",
"idx",
"]",
".",
"focus",
"(",
")",
";",
"}",
"return",
"idx",
";",
"}"
] | Moves the focus to the specified index within the elements list.
This will scope the index to the size of the element list if it changed.
@private
@param {Number} idx Specified index to move to.
@param {Array} elements Array with dom elements to move focus within.
@return {Number} Input index or a changed index if it was out of range. | [
"Moves",
"the",
"focus",
"to",
"the",
"specified",
"index",
"within",
"the",
"elements",
"list",
".",
"This",
"will",
"scope",
"the",
"index",
"to",
"the",
"size",
"of",
"the",
"element",
"list",
"if",
"it",
"changed",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L28532-L28544 |
48,253 | sadiqhabib/tinymce-dist | tinymce.full.js | moveFocus | function moveFocus(dir, elements) {
var idx = -1, navigationRoot = getNavigationRoot();
elements = elements || getFocusElements(navigationRoot.getEl());
for (var i = 0; i < elements.length; i++) {
if (elements[i] === focusedElement) {
idx = i;
}
}
idx += dir;
navigationRoot.lastAriaIndex = moveFocusToIndex(idx, elements);
} | javascript | function moveFocus(dir, elements) {
var idx = -1, navigationRoot = getNavigationRoot();
elements = elements || getFocusElements(navigationRoot.getEl());
for (var i = 0; i < elements.length; i++) {
if (elements[i] === focusedElement) {
idx = i;
}
}
idx += dir;
navigationRoot.lastAriaIndex = moveFocusToIndex(idx, elements);
} | [
"function",
"moveFocus",
"(",
"dir",
",",
"elements",
")",
"{",
"var",
"idx",
"=",
"-",
"1",
",",
"navigationRoot",
"=",
"getNavigationRoot",
"(",
")",
";",
"elements",
"=",
"elements",
"||",
"getFocusElements",
"(",
"navigationRoot",
".",
"getEl",
"(",
")",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"elements",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"elements",
"[",
"i",
"]",
"===",
"focusedElement",
")",
"{",
"idx",
"=",
"i",
";",
"}",
"}",
"idx",
"+=",
"dir",
";",
"navigationRoot",
".",
"lastAriaIndex",
"=",
"moveFocusToIndex",
"(",
"idx",
",",
"elements",
")",
";",
"}"
] | Moves the focus forwards or backwards.
@private
@param {Number} dir Direction to move in positive means forward, negative means backwards.
@param {Array} elements Optional array of elements to move within defaults to the current navigation roots elements. | [
"Moves",
"the",
"focus",
"forwards",
"or",
"backwards",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L28553-L28566 |
48,254 | sadiqhabib/tinymce-dist | tinymce.full.js | left | function left() {
var parentRole = getParentRole();
if (parentRole == "tablist") {
moveFocus(-1, getFocusElements(focusedElement.parentNode));
} else if (focusedControl.parent().submenu) {
cancel();
} else {
moveFocus(-1);
}
} | javascript | function left() {
var parentRole = getParentRole();
if (parentRole == "tablist") {
moveFocus(-1, getFocusElements(focusedElement.parentNode));
} else if (focusedControl.parent().submenu) {
cancel();
} else {
moveFocus(-1);
}
} | [
"function",
"left",
"(",
")",
"{",
"var",
"parentRole",
"=",
"getParentRole",
"(",
")",
";",
"if",
"(",
"parentRole",
"==",
"\"tablist\"",
")",
"{",
"moveFocus",
"(",
"-",
"1",
",",
"getFocusElements",
"(",
"focusedElement",
".",
"parentNode",
")",
")",
";",
"}",
"else",
"if",
"(",
"focusedControl",
".",
"parent",
"(",
")",
".",
"submenu",
")",
"{",
"cancel",
"(",
")",
";",
"}",
"else",
"{",
"moveFocus",
"(",
"-",
"1",
")",
";",
"}",
"}"
] | Moves the focus to the left this is called by the left key.
@private | [
"Moves",
"the",
"focus",
"to",
"the",
"left",
"this",
"is",
"called",
"by",
"the",
"left",
"key",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L28573-L28583 |
48,255 | sadiqhabib/tinymce-dist | tinymce.full.js | right | function right() {
var role = getRole(), parentRole = getParentRole();
if (parentRole == "tablist") {
moveFocus(1, getFocusElements(focusedElement.parentNode));
} else if (role == "menuitem" && parentRole == "menu" && getAriaProp('haspopup')) {
enter();
} else {
moveFocus(1);
}
} | javascript | function right() {
var role = getRole(), parentRole = getParentRole();
if (parentRole == "tablist") {
moveFocus(1, getFocusElements(focusedElement.parentNode));
} else if (role == "menuitem" && parentRole == "menu" && getAriaProp('haspopup')) {
enter();
} else {
moveFocus(1);
}
} | [
"function",
"right",
"(",
")",
"{",
"var",
"role",
"=",
"getRole",
"(",
")",
",",
"parentRole",
"=",
"getParentRole",
"(",
")",
";",
"if",
"(",
"parentRole",
"==",
"\"tablist\"",
")",
"{",
"moveFocus",
"(",
"1",
",",
"getFocusElements",
"(",
"focusedElement",
".",
"parentNode",
")",
")",
";",
"}",
"else",
"if",
"(",
"role",
"==",
"\"menuitem\"",
"&&",
"parentRole",
"==",
"\"menu\"",
"&&",
"getAriaProp",
"(",
"'haspopup'",
")",
")",
"{",
"enter",
"(",
")",
";",
"}",
"else",
"{",
"moveFocus",
"(",
"1",
")",
";",
"}",
"}"
] | Moves the focus to the right this is called by the right key.
@private | [
"Moves",
"the",
"focus",
"to",
"the",
"right",
"this",
"is",
"called",
"by",
"the",
"right",
"key",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L28590-L28600 |
48,256 | sadiqhabib/tinymce-dist | tinymce.full.js | down | function down() {
var role = getRole(), parentRole = getParentRole();
if (role == "menuitem" && parentRole == "menubar") {
enter();
} else if (role == "button" && getAriaProp('haspopup')) {
enter({ key: 'down' });
} else {
moveFocus(1);
}
} | javascript | function down() {
var role = getRole(), parentRole = getParentRole();
if (role == "menuitem" && parentRole == "menubar") {
enter();
} else if (role == "button" && getAriaProp('haspopup')) {
enter({ key: 'down' });
} else {
moveFocus(1);
}
} | [
"function",
"down",
"(",
")",
"{",
"var",
"role",
"=",
"getRole",
"(",
")",
",",
"parentRole",
"=",
"getParentRole",
"(",
")",
";",
"if",
"(",
"role",
"==",
"\"menuitem\"",
"&&",
"parentRole",
"==",
"\"menubar\"",
")",
"{",
"enter",
"(",
")",
";",
"}",
"else",
"if",
"(",
"role",
"==",
"\"button\"",
"&&",
"getAriaProp",
"(",
"'haspopup'",
")",
")",
"{",
"enter",
"(",
"{",
"key",
":",
"'down'",
"}",
")",
";",
"}",
"else",
"{",
"moveFocus",
"(",
"1",
")",
";",
"}",
"}"
] | Moves the focus to the up this is called by the down key.
@private | [
"Moves",
"the",
"focus",
"to",
"the",
"up",
"this",
"is",
"called",
"by",
"the",
"down",
"key",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L28616-L28626 |
48,257 | sadiqhabib/tinymce-dist | tinymce.full.js | tab | function tab(e) {
var parentRole = getParentRole();
if (parentRole == "tablist") {
var elm = getFocusElements(focusedControl.getEl('body'))[0];
if (elm) {
elm.focus();
}
} else {
moveFocus(e.shiftKey ? -1 : 1);
}
} | javascript | function tab(e) {
var parentRole = getParentRole();
if (parentRole == "tablist") {
var elm = getFocusElements(focusedControl.getEl('body'))[0];
if (elm) {
elm.focus();
}
} else {
moveFocus(e.shiftKey ? -1 : 1);
}
} | [
"function",
"tab",
"(",
"e",
")",
"{",
"var",
"parentRole",
"=",
"getParentRole",
"(",
")",
";",
"if",
"(",
"parentRole",
"==",
"\"tablist\"",
")",
"{",
"var",
"elm",
"=",
"getFocusElements",
"(",
"focusedControl",
".",
"getEl",
"(",
"'body'",
")",
")",
"[",
"0",
"]",
";",
"if",
"(",
"elm",
")",
"{",
"elm",
".",
"focus",
"(",
")",
";",
"}",
"}",
"else",
"{",
"moveFocus",
"(",
"e",
".",
"shiftKey",
"?",
"-",
"1",
":",
"1",
")",
";",
"}",
"}"
] | Moves the focus to the next item or previous item depending on shift key.
@private
@param {DOMEvent} e DOM event object. | [
"Moves",
"the",
"focus",
"to",
"the",
"next",
"item",
"or",
"previous",
"item",
"depending",
"on",
"shift",
"key",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L28634-L28646 |
48,258 | sadiqhabib/tinymce-dist | tinymce.full.js | function (selector) {
selector = selectorCache[selector] = selectorCache[selector] || new Selector(selector);
return selector.find(this);
} | javascript | function (selector) {
selector = selectorCache[selector] = selectorCache[selector] || new Selector(selector);
return selector.find(this);
} | [
"function",
"(",
"selector",
")",
"{",
"selector",
"=",
"selectorCache",
"[",
"selector",
"]",
"=",
"selectorCache",
"[",
"selector",
"]",
"||",
"new",
"Selector",
"(",
"selector",
")",
";",
"return",
"selector",
".",
"find",
"(",
"this",
")",
";",
"}"
] | Find child controls by selector.
@method find
@param {String} selector Selector CSS pattern to find children by.
@return {tinymce.ui.Collection} Control collection with child controls. | [
"Find",
"child",
"controls",
"by",
"selector",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L28840-L28844 |
|
48,259 | sadiqhabib/tinymce-dist | tinymce.full.js | function (items) {
var self = this;
self.items().add(self.create(items)).parent(self);
return self;
} | javascript | function (items) {
var self = this;
self.items().add(self.create(items)).parent(self);
return self;
} | [
"function",
"(",
"items",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"items",
"(",
")",
".",
"add",
"(",
"self",
".",
"create",
"(",
"items",
")",
")",
".",
"parent",
"(",
"self",
")",
";",
"return",
"self",
";",
"}"
] | Adds one or many items to the current container. This will create instances of
the object representations if needed.
@method add
@param {Array/Object/tinymce.ui.Control} items Array or item that will be added to the container.
@return {tinymce.ui.Collection} Current collection control. | [
"Adds",
"one",
"or",
"many",
"items",
"to",
"the",
"current",
"container",
".",
"This",
"will",
"create",
"instances",
"of",
"the",
"object",
"representations",
"if",
"needed",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L28854-L28860 |
|
48,260 | sadiqhabib/tinymce-dist | tinymce.full.js | function (keyboard) {
var self = this, focusCtrl, keyboardNav, items;
if (keyboard) {
keyboardNav = self.keyboardNav || self.parents().eq(-1)[0].keyboardNav;
if (keyboardNav) {
keyboardNav.focusFirst(self);
return;
}
}
items = self.find('*');
// TODO: Figure out a better way to auto focus alert dialog buttons
if (self.statusbar) {
items.add(self.statusbar.items());
}
items.each(function (ctrl) {
if (ctrl.settings.autofocus) {
focusCtrl = null;
return false;
}
if (ctrl.canFocus) {
focusCtrl = focusCtrl || ctrl;
}
});
if (focusCtrl) {
focusCtrl.focus();
}
return self;
} | javascript | function (keyboard) {
var self = this, focusCtrl, keyboardNav, items;
if (keyboard) {
keyboardNav = self.keyboardNav || self.parents().eq(-1)[0].keyboardNav;
if (keyboardNav) {
keyboardNav.focusFirst(self);
return;
}
}
items = self.find('*');
// TODO: Figure out a better way to auto focus alert dialog buttons
if (self.statusbar) {
items.add(self.statusbar.items());
}
items.each(function (ctrl) {
if (ctrl.settings.autofocus) {
focusCtrl = null;
return false;
}
if (ctrl.canFocus) {
focusCtrl = focusCtrl || ctrl;
}
});
if (focusCtrl) {
focusCtrl.focus();
}
return self;
} | [
"function",
"(",
"keyboard",
")",
"{",
"var",
"self",
"=",
"this",
",",
"focusCtrl",
",",
"keyboardNav",
",",
"items",
";",
"if",
"(",
"keyboard",
")",
"{",
"keyboardNav",
"=",
"self",
".",
"keyboardNav",
"||",
"self",
".",
"parents",
"(",
")",
".",
"eq",
"(",
"-",
"1",
")",
"[",
"0",
"]",
".",
"keyboardNav",
";",
"if",
"(",
"keyboardNav",
")",
"{",
"keyboardNav",
".",
"focusFirst",
"(",
"self",
")",
";",
"return",
";",
"}",
"}",
"items",
"=",
"self",
".",
"find",
"(",
"'*'",
")",
";",
"// TODO: Figure out a better way to auto focus alert dialog buttons",
"if",
"(",
"self",
".",
"statusbar",
")",
"{",
"items",
".",
"add",
"(",
"self",
".",
"statusbar",
".",
"items",
"(",
")",
")",
";",
"}",
"items",
".",
"each",
"(",
"function",
"(",
"ctrl",
")",
"{",
"if",
"(",
"ctrl",
".",
"settings",
".",
"autofocus",
")",
"{",
"focusCtrl",
"=",
"null",
";",
"return",
"false",
";",
"}",
"if",
"(",
"ctrl",
".",
"canFocus",
")",
"{",
"focusCtrl",
"=",
"focusCtrl",
"||",
"ctrl",
";",
"}",
"}",
")",
";",
"if",
"(",
"focusCtrl",
")",
"{",
"focusCtrl",
".",
"focus",
"(",
")",
";",
"}",
"return",
"self",
";",
"}"
] | Focuses the current container instance. This will look
for the first control in the container and focus that.
@method focus
@param {Boolean} keyboard Optional true/false if the focus was a keyboard focus or not.
@return {tinymce.ui.Collection} Current instance. | [
"Focuses",
"the",
"current",
"container",
"instance",
".",
"This",
"will",
"look",
"for",
"the",
"first",
"control",
"in",
"the",
"container",
"and",
"focus",
"that",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L28870-L28905 |
|
48,261 | sadiqhabib/tinymce-dist | tinymce.full.js | function (oldItem, newItem) {
var ctrlElm, items = this.items(), i = items.length;
// Replace the item in collection
while (i--) {
if (items[i] === oldItem) {
items[i] = newItem;
break;
}
}
if (i >= 0) {
// Remove new item from DOM
ctrlElm = newItem.getEl();
if (ctrlElm) {
ctrlElm.parentNode.removeChild(ctrlElm);
}
// Remove old item from DOM
ctrlElm = oldItem.getEl();
if (ctrlElm) {
ctrlElm.parentNode.removeChild(ctrlElm);
}
}
// Adopt the item
newItem.parent(this);
} | javascript | function (oldItem, newItem) {
var ctrlElm, items = this.items(), i = items.length;
// Replace the item in collection
while (i--) {
if (items[i] === oldItem) {
items[i] = newItem;
break;
}
}
if (i >= 0) {
// Remove new item from DOM
ctrlElm = newItem.getEl();
if (ctrlElm) {
ctrlElm.parentNode.removeChild(ctrlElm);
}
// Remove old item from DOM
ctrlElm = oldItem.getEl();
if (ctrlElm) {
ctrlElm.parentNode.removeChild(ctrlElm);
}
}
// Adopt the item
newItem.parent(this);
} | [
"function",
"(",
"oldItem",
",",
"newItem",
")",
"{",
"var",
"ctrlElm",
",",
"items",
"=",
"this",
".",
"items",
"(",
")",
",",
"i",
"=",
"items",
".",
"length",
";",
"// Replace the item in collection",
"while",
"(",
"i",
"--",
")",
"{",
"if",
"(",
"items",
"[",
"i",
"]",
"===",
"oldItem",
")",
"{",
"items",
"[",
"i",
"]",
"=",
"newItem",
";",
"break",
";",
"}",
"}",
"if",
"(",
"i",
">=",
"0",
")",
"{",
"// Remove new item from DOM",
"ctrlElm",
"=",
"newItem",
".",
"getEl",
"(",
")",
";",
"if",
"(",
"ctrlElm",
")",
"{",
"ctrlElm",
".",
"parentNode",
".",
"removeChild",
"(",
"ctrlElm",
")",
";",
"}",
"// Remove old item from DOM",
"ctrlElm",
"=",
"oldItem",
".",
"getEl",
"(",
")",
";",
"if",
"(",
"ctrlElm",
")",
"{",
"ctrlElm",
".",
"parentNode",
".",
"removeChild",
"(",
"ctrlElm",
")",
";",
"}",
"}",
"// Adopt the item",
"newItem",
".",
"parent",
"(",
"this",
")",
";",
"}"
] | Replaces the specified child control with a new control.
@method replace
@param {tinymce.ui.Control} oldItem Old item to be replaced.
@param {tinymce.ui.Control} newItem New item to be inserted. | [
"Replaces",
"the",
"specified",
"child",
"control",
"with",
"a",
"new",
"control",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L28914-L28941 |
|
48,262 | sadiqhabib/tinymce-dist | tinymce.full.js | function (items) {
var self = this, settings, ctrlItems = [];
// Non array structure, then force it into an array
if (!Tools.isArray(items)) {
items = [items];
}
// Add default type to each child control
Tools.each(items, function (item) {
if (item) {
// Construct item if needed
if (!(item instanceof Control)) {
// Name only then convert it to an object
if (typeof item == "string") {
item = { type: item };
}
// Create control instance based on input settings and default settings
settings = Tools.extend({}, self.settings.defaults, item);
item.type = settings.type = settings.type || item.type || self.settings.defaultType ||
(settings.defaults ? settings.defaults.type : null);
item = Factory.create(settings);
}
ctrlItems.push(item);
}
});
return ctrlItems;
} | javascript | function (items) {
var self = this, settings, ctrlItems = [];
// Non array structure, then force it into an array
if (!Tools.isArray(items)) {
items = [items];
}
// Add default type to each child control
Tools.each(items, function (item) {
if (item) {
// Construct item if needed
if (!(item instanceof Control)) {
// Name only then convert it to an object
if (typeof item == "string") {
item = { type: item };
}
// Create control instance based on input settings and default settings
settings = Tools.extend({}, self.settings.defaults, item);
item.type = settings.type = settings.type || item.type || self.settings.defaultType ||
(settings.defaults ? settings.defaults.type : null);
item = Factory.create(settings);
}
ctrlItems.push(item);
}
});
return ctrlItems;
} | [
"function",
"(",
"items",
")",
"{",
"var",
"self",
"=",
"this",
",",
"settings",
",",
"ctrlItems",
"=",
"[",
"]",
";",
"// Non array structure, then force it into an array",
"if",
"(",
"!",
"Tools",
".",
"isArray",
"(",
"items",
")",
")",
"{",
"items",
"=",
"[",
"items",
"]",
";",
"}",
"// Add default type to each child control",
"Tools",
".",
"each",
"(",
"items",
",",
"function",
"(",
"item",
")",
"{",
"if",
"(",
"item",
")",
"{",
"// Construct item if needed",
"if",
"(",
"!",
"(",
"item",
"instanceof",
"Control",
")",
")",
"{",
"// Name only then convert it to an object",
"if",
"(",
"typeof",
"item",
"==",
"\"string\"",
")",
"{",
"item",
"=",
"{",
"type",
":",
"item",
"}",
";",
"}",
"// Create control instance based on input settings and default settings",
"settings",
"=",
"Tools",
".",
"extend",
"(",
"{",
"}",
",",
"self",
".",
"settings",
".",
"defaults",
",",
"item",
")",
";",
"item",
".",
"type",
"=",
"settings",
".",
"type",
"=",
"settings",
".",
"type",
"||",
"item",
".",
"type",
"||",
"self",
".",
"settings",
".",
"defaultType",
"||",
"(",
"settings",
".",
"defaults",
"?",
"settings",
".",
"defaults",
".",
"type",
":",
"null",
")",
";",
"item",
"=",
"Factory",
".",
"create",
"(",
"settings",
")",
";",
"}",
"ctrlItems",
".",
"push",
"(",
"item",
")",
";",
"}",
"}",
")",
";",
"return",
"ctrlItems",
";",
"}"
] | Creates the specified items. If any of the items is plain JSON style objects
it will convert these into real tinymce.ui.Control instances.
@method create
@param {Array} items Array of items to convert into control instances.
@return {Array} Array with control instances. | [
"Creates",
"the",
"specified",
"items",
".",
"If",
"any",
"of",
"the",
"items",
"is",
"plain",
"JSON",
"style",
"objects",
"it",
"will",
"convert",
"these",
"into",
"real",
"tinymce",
".",
"ui",
".",
"Control",
"instances",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L28951-L28981 |
|
48,263 | sadiqhabib/tinymce-dist | tinymce.full.js | function () {
var self = this;
// Render any new items
self.items().each(function (ctrl, index) {
var containerElm;
ctrl.parent(self);
if (!ctrl.state.get('rendered')) {
containerElm = self.getEl('body');
// Insert or append the item
if (containerElm.hasChildNodes() && index <= containerElm.childNodes.length - 1) {
$(containerElm.childNodes[index]).before(ctrl.renderHtml());
} else {
$(containerElm).append(ctrl.renderHtml());
}
ctrl.postRender();
ReflowQueue.add(ctrl);
}
});
self._layout.applyClasses(self.items().filter(':visible'));
self._lastRect = null;
return self;
} | javascript | function () {
var self = this;
// Render any new items
self.items().each(function (ctrl, index) {
var containerElm;
ctrl.parent(self);
if (!ctrl.state.get('rendered')) {
containerElm = self.getEl('body');
// Insert or append the item
if (containerElm.hasChildNodes() && index <= containerElm.childNodes.length - 1) {
$(containerElm.childNodes[index]).before(ctrl.renderHtml());
} else {
$(containerElm).append(ctrl.renderHtml());
}
ctrl.postRender();
ReflowQueue.add(ctrl);
}
});
self._layout.applyClasses(self.items().filter(':visible'));
self._lastRect = null;
return self;
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// Render any new items",
"self",
".",
"items",
"(",
")",
".",
"each",
"(",
"function",
"(",
"ctrl",
",",
"index",
")",
"{",
"var",
"containerElm",
";",
"ctrl",
".",
"parent",
"(",
"self",
")",
";",
"if",
"(",
"!",
"ctrl",
".",
"state",
".",
"get",
"(",
"'rendered'",
")",
")",
"{",
"containerElm",
"=",
"self",
".",
"getEl",
"(",
"'body'",
")",
";",
"// Insert or append the item",
"if",
"(",
"containerElm",
".",
"hasChildNodes",
"(",
")",
"&&",
"index",
"<=",
"containerElm",
".",
"childNodes",
".",
"length",
"-",
"1",
")",
"{",
"$",
"(",
"containerElm",
".",
"childNodes",
"[",
"index",
"]",
")",
".",
"before",
"(",
"ctrl",
".",
"renderHtml",
"(",
")",
")",
";",
"}",
"else",
"{",
"$",
"(",
"containerElm",
")",
".",
"append",
"(",
"ctrl",
".",
"renderHtml",
"(",
")",
")",
";",
"}",
"ctrl",
".",
"postRender",
"(",
")",
";",
"ReflowQueue",
".",
"add",
"(",
"ctrl",
")",
";",
"}",
"}",
")",
";",
"self",
".",
"_layout",
".",
"applyClasses",
"(",
"self",
".",
"items",
"(",
")",
".",
"filter",
"(",
"':visible'",
")",
")",
";",
"self",
".",
"_lastRect",
"=",
"null",
";",
"return",
"self",
";",
"}"
] | Renders new control instances.
@private | [
"Renders",
"new",
"control",
"instances",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L28988-L29016 |
|
48,264 | sadiqhabib/tinymce-dist | tinymce.full.js | function (items) {
var self = this;
self.items().set(self.create(items).concat(self.items().toArray()));
return self.renderNew();
} | javascript | function (items) {
var self = this;
self.items().set(self.create(items).concat(self.items().toArray()));
return self.renderNew();
} | [
"function",
"(",
"items",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"items",
"(",
")",
".",
"set",
"(",
"self",
".",
"create",
"(",
"items",
")",
".",
"concat",
"(",
"self",
".",
"items",
"(",
")",
".",
"toArray",
"(",
")",
")",
")",
";",
"return",
"self",
".",
"renderNew",
"(",
")",
";",
"}"
] | Prepends new instances to the current container.
@method prepend
@param {Array/tinymce.ui.Collection} items Array if controls to prepend.
@return {tinymce.ui.Container} Current container instance. | [
"Prepends",
"new",
"instances",
"to",
"the",
"current",
"container",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L29036-L29042 |
|
48,265 | sadiqhabib/tinymce-dist | tinymce.full.js | function (items, index, before) {
var self = this, curItems, beforeItems, afterItems;
items = self.create(items);
curItems = self.items();
if (!before && index < curItems.length - 1) {
index += 1;
}
if (index >= 0 && index < curItems.length) {
beforeItems = curItems.slice(0, index).toArray();
afterItems = curItems.slice(index).toArray();
curItems.set(beforeItems.concat(items, afterItems));
}
return self.renderNew();
} | javascript | function (items, index, before) {
var self = this, curItems, beforeItems, afterItems;
items = self.create(items);
curItems = self.items();
if (!before && index < curItems.length - 1) {
index += 1;
}
if (index >= 0 && index < curItems.length) {
beforeItems = curItems.slice(0, index).toArray();
afterItems = curItems.slice(index).toArray();
curItems.set(beforeItems.concat(items, afterItems));
}
return self.renderNew();
} | [
"function",
"(",
"items",
",",
"index",
",",
"before",
")",
"{",
"var",
"self",
"=",
"this",
",",
"curItems",
",",
"beforeItems",
",",
"afterItems",
";",
"items",
"=",
"self",
".",
"create",
"(",
"items",
")",
";",
"curItems",
"=",
"self",
".",
"items",
"(",
")",
";",
"if",
"(",
"!",
"before",
"&&",
"index",
"<",
"curItems",
".",
"length",
"-",
"1",
")",
"{",
"index",
"+=",
"1",
";",
"}",
"if",
"(",
"index",
">=",
"0",
"&&",
"index",
"<",
"curItems",
".",
"length",
")",
"{",
"beforeItems",
"=",
"curItems",
".",
"slice",
"(",
"0",
",",
"index",
")",
".",
"toArray",
"(",
")",
";",
"afterItems",
"=",
"curItems",
".",
"slice",
"(",
"index",
")",
".",
"toArray",
"(",
")",
";",
"curItems",
".",
"set",
"(",
"beforeItems",
".",
"concat",
"(",
"items",
",",
"afterItems",
")",
")",
";",
"}",
"return",
"self",
".",
"renderNew",
"(",
")",
";",
"}"
] | Inserts an control at a specific index.
@method insert
@param {Array/tinymce.ui.Collection} items Array if controls to insert.
@param {Number} index Index to insert controls at.
@param {Boolean} [before=false] Inserts controls before the index. | [
"Inserts",
"an",
"control",
"at",
"a",
"specific",
"index",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L29052-L29069 |
|
48,266 | sadiqhabib/tinymce-dist | tinymce.full.js | function (data) {
var self = this;
for (var name in data) {
self.find('#' + name).value(data[name]);
}
return self;
} | javascript | function (data) {
var self = this;
for (var name in data) {
self.find('#' + name).value(data[name]);
}
return self;
} | [
"function",
"(",
"data",
")",
"{",
"var",
"self",
"=",
"this",
";",
"for",
"(",
"var",
"name",
"in",
"data",
")",
"{",
"self",
".",
"find",
"(",
"'#'",
"+",
"name",
")",
".",
"value",
"(",
"data",
"[",
"name",
"]",
")",
";",
"}",
"return",
"self",
";",
"}"
] | Populates the form fields from the specified JSON data object.
Control items in the form that matches the data will have it's value set.
@method fromJSON
@param {Object} data JSON data object to set control values by.
@return {tinymce.ui.Container} Current form instance. | [
"Populates",
"the",
"form",
"fields",
"from",
"the",
"specified",
"JSON",
"data",
"object",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L29080-L29088 |
|
48,267 | sadiqhabib/tinymce-dist | tinymce.full.js | function () {
var self = this, data = {};
self.find('*').each(function (ctrl) {
var name = ctrl.name(), value = ctrl.value();
if (name && typeof value != "undefined") {
data[name] = value;
}
});
return data;
} | javascript | function () {
var self = this, data = {};
self.find('*').each(function (ctrl) {
var name = ctrl.name(), value = ctrl.value();
if (name && typeof value != "undefined") {
data[name] = value;
}
});
return data;
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
",",
"data",
"=",
"{",
"}",
";",
"self",
".",
"find",
"(",
"'*'",
")",
".",
"each",
"(",
"function",
"(",
"ctrl",
")",
"{",
"var",
"name",
"=",
"ctrl",
".",
"name",
"(",
")",
",",
"value",
"=",
"ctrl",
".",
"value",
"(",
")",
";",
"if",
"(",
"name",
"&&",
"typeof",
"value",
"!=",
"\"undefined\"",
")",
"{",
"data",
"[",
"name",
"]",
"=",
"value",
";",
"}",
"}",
")",
";",
"return",
"data",
";",
"}"
] | Serializes the form into a JSON object by getting all items
that has a name and a value.
@method toJSON
@return {Object} JSON object with form data. | [
"Serializes",
"the",
"form",
"into",
"a",
"JSON",
"object",
"by",
"getting",
"all",
"items",
"that",
"has",
"a",
"name",
"and",
"a",
"value",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L29097-L29109 |
|
48,268 | sadiqhabib/tinymce-dist | tinymce.full.js | function () {
var i;
ReflowQueue.remove(this);
if (this.visible()) {
Control.repaintControls = [];
Control.repaintControls.map = {};
this.recalc();
i = Control.repaintControls.length;
while (i--) {
Control.repaintControls[i].repaint();
}
// TODO: Fix me!
if (this.settings.layout !== "flow" && this.settings.layout !== "stack") {
this.repaint();
}
Control.repaintControls = [];
}
return this;
} | javascript | function () {
var i;
ReflowQueue.remove(this);
if (this.visible()) {
Control.repaintControls = [];
Control.repaintControls.map = {};
this.recalc();
i = Control.repaintControls.length;
while (i--) {
Control.repaintControls[i].repaint();
}
// TODO: Fix me!
if (this.settings.layout !== "flow" && this.settings.layout !== "stack") {
this.repaint();
}
Control.repaintControls = [];
}
return this;
} | [
"function",
"(",
")",
"{",
"var",
"i",
";",
"ReflowQueue",
".",
"remove",
"(",
"this",
")",
";",
"if",
"(",
"this",
".",
"visible",
"(",
")",
")",
"{",
"Control",
".",
"repaintControls",
"=",
"[",
"]",
";",
"Control",
".",
"repaintControls",
".",
"map",
"=",
"{",
"}",
";",
"this",
".",
"recalc",
"(",
")",
";",
"i",
"=",
"Control",
".",
"repaintControls",
".",
"length",
";",
"while",
"(",
"i",
"--",
")",
"{",
"Control",
".",
"repaintControls",
"[",
"i",
"]",
".",
"repaint",
"(",
")",
";",
"}",
"// TODO: Fix me!",
"if",
"(",
"this",
".",
"settings",
".",
"layout",
"!==",
"\"flow\"",
"&&",
"this",
".",
"settings",
".",
"layout",
"!==",
"\"stack\"",
")",
"{",
"this",
".",
"repaint",
"(",
")",
";",
"}",
"Control",
".",
"repaintControls",
"=",
"[",
"]",
";",
"}",
"return",
"this",
";",
"}"
] | Reflows the current container and it's children and possible parents.
This should be used after you for example append children to the current control so
that the layout managers know that they need to reposition everything.
@example
container.append({type: 'button', text: 'My button'}).reflow();
@method reflow
@return {tinymce.ui.Container} Current container instance. | [
"Reflows",
"the",
"current",
"container",
"and",
"it",
"s",
"children",
"and",
"possible",
"parents",
".",
"This",
"should",
"be",
"used",
"after",
"you",
"for",
"example",
"append",
"children",
"to",
"the",
"current",
"control",
"so",
"that",
"the",
"layout",
"managers",
"know",
"that",
"they",
"need",
"to",
"reposition",
"everything",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L29215-L29240 |
|
48,269 | sadiqhabib/tinymce-dist | tinymce.full.js | function (elm, rel) {
if (typeof rel != 'string') {
rel = this.testMoveRel(elm, rel);
}
var pos = calculateRelativePosition(this, elm, rel);
return this.moveTo(pos.x, pos.y);
} | javascript | function (elm, rel) {
if (typeof rel != 'string') {
rel = this.testMoveRel(elm, rel);
}
var pos = calculateRelativePosition(this, elm, rel);
return this.moveTo(pos.x, pos.y);
} | [
"function",
"(",
"elm",
",",
"rel",
")",
"{",
"if",
"(",
"typeof",
"rel",
"!=",
"'string'",
")",
"{",
"rel",
"=",
"this",
".",
"testMoveRel",
"(",
"elm",
",",
"rel",
")",
";",
"}",
"var",
"pos",
"=",
"calculateRelativePosition",
"(",
"this",
",",
"elm",
",",
"rel",
")",
";",
"return",
"this",
".",
"moveTo",
"(",
"pos",
".",
"x",
",",
"pos",
".",
"y",
")",
";",
"}"
] | Move relative to the specified element.
@method moveRel
@param {Element} elm Element to move relative to.
@param {String} rel Relative mode. For example: br-tl.
@return {tinymce.ui.Control} Current control instance. | [
"Move",
"relative",
"to",
"the",
"specified",
"element",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L29741-L29748 |
|
48,270 | sadiqhabib/tinymce-dist | tinymce.full.js | function (dx, dy) {
var self = this, rect = self.layoutRect();
self.moveTo(rect.x + dx, rect.y + dy);
return self;
} | javascript | function (dx, dy) {
var self = this, rect = self.layoutRect();
self.moveTo(rect.x + dx, rect.y + dy);
return self;
} | [
"function",
"(",
"dx",
",",
"dy",
")",
"{",
"var",
"self",
"=",
"this",
",",
"rect",
"=",
"self",
".",
"layoutRect",
"(",
")",
";",
"self",
".",
"moveTo",
"(",
"rect",
".",
"x",
"+",
"dx",
",",
"rect",
".",
"y",
"+",
"dy",
")",
";",
"return",
"self",
";",
"}"
] | Move by a relative x, y values.
@method moveBy
@param {Number} dx Relative x position.
@param {Number} dy Relative y position.
@return {tinymce.ui.Control} Current control instance. | [
"Move",
"by",
"a",
"relative",
"x",
"y",
"values",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L29758-L29764 |
|
48,271 | sadiqhabib/tinymce-dist | tinymce.full.js | function (x, y) {
var self = this;
// TODO: Move this to some global class
function constrain(value, max, size) {
if (value < 0) {
return 0;
}
if (value + size > max) {
value = max - size;
return value < 0 ? 0 : value;
}
return value;
}
if (self.settings.constrainToViewport) {
var viewPortRect = DomUtils.getViewPort(window);
var layoutRect = self.layoutRect();
x = constrain(x, viewPortRect.w + viewPortRect.x, layoutRect.w);
y = constrain(y, viewPortRect.h + viewPortRect.y, layoutRect.h);
}
if (self.state.get('rendered')) {
self.layoutRect({ x: x, y: y }).repaint();
} else {
self.settings.x = x;
self.settings.y = y;
}
self.fire('move', { x: x, y: y });
return self;
} | javascript | function (x, y) {
var self = this;
// TODO: Move this to some global class
function constrain(value, max, size) {
if (value < 0) {
return 0;
}
if (value + size > max) {
value = max - size;
return value < 0 ? 0 : value;
}
return value;
}
if (self.settings.constrainToViewport) {
var viewPortRect = DomUtils.getViewPort(window);
var layoutRect = self.layoutRect();
x = constrain(x, viewPortRect.w + viewPortRect.x, layoutRect.w);
y = constrain(y, viewPortRect.h + viewPortRect.y, layoutRect.h);
}
if (self.state.get('rendered')) {
self.layoutRect({ x: x, y: y }).repaint();
} else {
self.settings.x = x;
self.settings.y = y;
}
self.fire('move', { x: x, y: y });
return self;
} | [
"function",
"(",
"x",
",",
"y",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// TODO: Move this to some global class",
"function",
"constrain",
"(",
"value",
",",
"max",
",",
"size",
")",
"{",
"if",
"(",
"value",
"<",
"0",
")",
"{",
"return",
"0",
";",
"}",
"if",
"(",
"value",
"+",
"size",
">",
"max",
")",
"{",
"value",
"=",
"max",
"-",
"size",
";",
"return",
"value",
"<",
"0",
"?",
"0",
":",
"value",
";",
"}",
"return",
"value",
";",
"}",
"if",
"(",
"self",
".",
"settings",
".",
"constrainToViewport",
")",
"{",
"var",
"viewPortRect",
"=",
"DomUtils",
".",
"getViewPort",
"(",
"window",
")",
";",
"var",
"layoutRect",
"=",
"self",
".",
"layoutRect",
"(",
")",
";",
"x",
"=",
"constrain",
"(",
"x",
",",
"viewPortRect",
".",
"w",
"+",
"viewPortRect",
".",
"x",
",",
"layoutRect",
".",
"w",
")",
";",
"y",
"=",
"constrain",
"(",
"y",
",",
"viewPortRect",
".",
"h",
"+",
"viewPortRect",
".",
"y",
",",
"layoutRect",
".",
"h",
")",
";",
"}",
"if",
"(",
"self",
".",
"state",
".",
"get",
"(",
"'rendered'",
")",
")",
"{",
"self",
".",
"layoutRect",
"(",
"{",
"x",
":",
"x",
",",
"y",
":",
"y",
"}",
")",
".",
"repaint",
"(",
")",
";",
"}",
"else",
"{",
"self",
".",
"settings",
".",
"x",
"=",
"x",
";",
"self",
".",
"settings",
".",
"y",
"=",
"y",
";",
"}",
"self",
".",
"fire",
"(",
"'move'",
",",
"{",
"x",
":",
"x",
",",
"y",
":",
"y",
"}",
")",
";",
"return",
"self",
";",
"}"
] | Move to absolute position.
@method moveTo
@param {Number} x Absolute x position.
@param {Number} y Absolute y position.
@return {tinymce.ui.Control} Current control instance. | [
"Move",
"to",
"absolute",
"position",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L29774-L29809 |
|
48,272 | sadiqhabib/tinymce-dist | tinymce.full.js | repositionPanel | function repositionPanel(panel) {
var scrollY = DomUtils.getViewPort().y;
function toggleFixedChildPanels(fixed, deltaY) {
var parent;
for (var i = 0; i < visiblePanels.length; i++) {
if (visiblePanels[i] != panel) {
parent = visiblePanels[i].parent();
while (parent && (parent = parent.parent())) {
if (parent == panel) {
visiblePanels[i].fixed(fixed).moveBy(0, deltaY).repaint();
}
}
}
}
}
if (panel.settings.autofix) {
if (!panel.state.get('fixed')) {
panel._autoFixY = panel.layoutRect().y;
if (panel._autoFixY < scrollY) {
panel.fixed(true).layoutRect({ y: 0 }).repaint();
toggleFixedChildPanels(true, scrollY - panel._autoFixY);
}
} else {
if (panel._autoFixY > scrollY) {
panel.fixed(false).layoutRect({ y: panel._autoFixY }).repaint();
toggleFixedChildPanels(false, panel._autoFixY - scrollY);
}
}
}
} | javascript | function repositionPanel(panel) {
var scrollY = DomUtils.getViewPort().y;
function toggleFixedChildPanels(fixed, deltaY) {
var parent;
for (var i = 0; i < visiblePanels.length; i++) {
if (visiblePanels[i] != panel) {
parent = visiblePanels[i].parent();
while (parent && (parent = parent.parent())) {
if (parent == panel) {
visiblePanels[i].fixed(fixed).moveBy(0, deltaY).repaint();
}
}
}
}
}
if (panel.settings.autofix) {
if (!panel.state.get('fixed')) {
panel._autoFixY = panel.layoutRect().y;
if (panel._autoFixY < scrollY) {
panel.fixed(true).layoutRect({ y: 0 }).repaint();
toggleFixedChildPanels(true, scrollY - panel._autoFixY);
}
} else {
if (panel._autoFixY > scrollY) {
panel.fixed(false).layoutRect({ y: panel._autoFixY }).repaint();
toggleFixedChildPanels(false, panel._autoFixY - scrollY);
}
}
}
} | [
"function",
"repositionPanel",
"(",
"panel",
")",
"{",
"var",
"scrollY",
"=",
"DomUtils",
".",
"getViewPort",
"(",
")",
".",
"y",
";",
"function",
"toggleFixedChildPanels",
"(",
"fixed",
",",
"deltaY",
")",
"{",
"var",
"parent",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"visiblePanels",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"visiblePanels",
"[",
"i",
"]",
"!=",
"panel",
")",
"{",
"parent",
"=",
"visiblePanels",
"[",
"i",
"]",
".",
"parent",
"(",
")",
";",
"while",
"(",
"parent",
"&&",
"(",
"parent",
"=",
"parent",
".",
"parent",
"(",
")",
")",
")",
"{",
"if",
"(",
"parent",
"==",
"panel",
")",
"{",
"visiblePanels",
"[",
"i",
"]",
".",
"fixed",
"(",
"fixed",
")",
".",
"moveBy",
"(",
"0",
",",
"deltaY",
")",
".",
"repaint",
"(",
")",
";",
"}",
"}",
"}",
"}",
"}",
"if",
"(",
"panel",
".",
"settings",
".",
"autofix",
")",
"{",
"if",
"(",
"!",
"panel",
".",
"state",
".",
"get",
"(",
"'fixed'",
")",
")",
"{",
"panel",
".",
"_autoFixY",
"=",
"panel",
".",
"layoutRect",
"(",
")",
".",
"y",
";",
"if",
"(",
"panel",
".",
"_autoFixY",
"<",
"scrollY",
")",
"{",
"panel",
".",
"fixed",
"(",
"true",
")",
".",
"layoutRect",
"(",
"{",
"y",
":",
"0",
"}",
")",
".",
"repaint",
"(",
")",
";",
"toggleFixedChildPanels",
"(",
"true",
",",
"scrollY",
"-",
"panel",
".",
"_autoFixY",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"panel",
".",
"_autoFixY",
">",
"scrollY",
")",
"{",
"panel",
".",
"fixed",
"(",
"false",
")",
".",
"layoutRect",
"(",
"{",
"y",
":",
"panel",
".",
"_autoFixY",
"}",
")",
".",
"repaint",
"(",
")",
";",
"toggleFixedChildPanels",
"(",
"false",
",",
"panel",
".",
"_autoFixY",
"-",
"scrollY",
")",
";",
"}",
"}",
"}",
"}"
] | Repositions the panel to the top of page if the panel is outside of the visual viewport. It will
also reposition all child panels of the current panel. | [
"Repositions",
"the",
"panel",
"to",
"the",
"top",
"of",
"page",
"if",
"the",
"panel",
"is",
"outside",
"of",
"the",
"visual",
"viewport",
".",
"It",
"will",
"also",
"reposition",
"all",
"child",
"panels",
"of",
"the",
"current",
"panel",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L30005-L30039 |
48,273 | sadiqhabib/tinymce-dist | tinymce.full.js | function () {
var self = this, i, state = self._super();
i = visiblePanels.length;
while (i--) {
if (visiblePanels[i] === self) {
break;
}
}
if (i === -1) {
visiblePanels.push(self);
}
return state;
} | javascript | function () {
var self = this, i, state = self._super();
i = visiblePanels.length;
while (i--) {
if (visiblePanels[i] === self) {
break;
}
}
if (i === -1) {
visiblePanels.push(self);
}
return state;
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
",",
"i",
",",
"state",
"=",
"self",
".",
"_super",
"(",
")",
";",
"i",
"=",
"visiblePanels",
".",
"length",
";",
"while",
"(",
"i",
"--",
")",
"{",
"if",
"(",
"visiblePanels",
"[",
"i",
"]",
"===",
"self",
")",
"{",
"break",
";",
"}",
"}",
"if",
"(",
"i",
"===",
"-",
"1",
")",
"{",
"visiblePanels",
".",
"push",
"(",
"self",
")",
";",
"}",
"return",
"state",
";",
"}"
] | Shows the current float panel.
@method show
@return {tinymce.ui.FloatPanel} Current floatpanel instance. | [
"Shows",
"the",
"current",
"float",
"panel",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L30184-L30199 |
|
48,274 | sadiqhabib/tinymce-dist | tinymce.full.js | function () {
var self = this;
if (!self.fire('close').isDefaultPrevented()) {
self.remove();
addRemove(false, self);
}
return self;
} | javascript | function () {
var self = this;
if (!self.fire('close').isDefaultPrevented()) {
self.remove();
addRemove(false, self);
}
return self;
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"if",
"(",
"!",
"self",
".",
"fire",
"(",
"'close'",
")",
".",
"isDefaultPrevented",
"(",
")",
")",
"{",
"self",
".",
"remove",
"(",
")",
";",
"addRemove",
"(",
"false",
",",
"self",
")",
";",
"}",
"return",
"self",
";",
"}"
] | Closes the float panel. This will remove the float panel from page and fire the close event.
@method close | [
"Closes",
"the",
"float",
"panel",
".",
"This",
"will",
"remove",
"the",
"float",
"panel",
"from",
"page",
"and",
"fire",
"the",
"close",
"event",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L30229-L30238 |
|
48,275 | sadiqhabib/tinymce-dist | tinymce.full.js | function (state) {
var self = this, documentElement = document.documentElement, slowRendering, prefix = self.classPrefix, layoutRect;
if (state != self._fullscreen) {
$(window).on('resize', function () {
var time;
if (self._fullscreen) {
// Time the layout time if it's to slow use a timeout to not hog the CPU
if (!slowRendering) {
time = new Date().getTime();
var rect = DomUtils.getWindowSize();
self.moveTo(0, 0).resizeTo(rect.w, rect.h);
if ((new Date().getTime()) - time > 50) {
slowRendering = true;
}
} else {
if (!self._timer) {
self._timer = Delay.setTimeout(function () {
var rect = DomUtils.getWindowSize();
self.moveTo(0, 0).resizeTo(rect.w, rect.h);
self._timer = 0;
}, 50);
}
}
}
});
layoutRect = self.layoutRect();
self._fullscreen = state;
if (!state) {
self.borderBox = BoxUtils.parseBox(self.settings.border);
self.getEl('head').style.display = '';
layoutRect.deltaH += layoutRect.headerH;
$([documentElement, document.body]).removeClass(prefix + 'fullscreen');
self.classes.remove('fullscreen');
self.moveTo(self._initial.x, self._initial.y).resizeTo(self._initial.w, self._initial.h);
} else {
self._initial = { x: layoutRect.x, y: layoutRect.y, w: layoutRect.w, h: layoutRect.h };
self.borderBox = BoxUtils.parseBox('0');
self.getEl('head').style.display = 'none';
layoutRect.deltaH -= layoutRect.headerH + 2;
$([documentElement, document.body]).addClass(prefix + 'fullscreen');
self.classes.add('fullscreen');
var rect = DomUtils.getWindowSize();
self.moveTo(0, 0).resizeTo(rect.w, rect.h);
}
}
return self.reflow();
} | javascript | function (state) {
var self = this, documentElement = document.documentElement, slowRendering, prefix = self.classPrefix, layoutRect;
if (state != self._fullscreen) {
$(window).on('resize', function () {
var time;
if (self._fullscreen) {
// Time the layout time if it's to slow use a timeout to not hog the CPU
if (!slowRendering) {
time = new Date().getTime();
var rect = DomUtils.getWindowSize();
self.moveTo(0, 0).resizeTo(rect.w, rect.h);
if ((new Date().getTime()) - time > 50) {
slowRendering = true;
}
} else {
if (!self._timer) {
self._timer = Delay.setTimeout(function () {
var rect = DomUtils.getWindowSize();
self.moveTo(0, 0).resizeTo(rect.w, rect.h);
self._timer = 0;
}, 50);
}
}
}
});
layoutRect = self.layoutRect();
self._fullscreen = state;
if (!state) {
self.borderBox = BoxUtils.parseBox(self.settings.border);
self.getEl('head').style.display = '';
layoutRect.deltaH += layoutRect.headerH;
$([documentElement, document.body]).removeClass(prefix + 'fullscreen');
self.classes.remove('fullscreen');
self.moveTo(self._initial.x, self._initial.y).resizeTo(self._initial.w, self._initial.h);
} else {
self._initial = { x: layoutRect.x, y: layoutRect.y, w: layoutRect.w, h: layoutRect.h };
self.borderBox = BoxUtils.parseBox('0');
self.getEl('head').style.display = 'none';
layoutRect.deltaH -= layoutRect.headerH + 2;
$([documentElement, document.body]).addClass(prefix + 'fullscreen');
self.classes.add('fullscreen');
var rect = DomUtils.getWindowSize();
self.moveTo(0, 0).resizeTo(rect.w, rect.h);
}
}
return self.reflow();
} | [
"function",
"(",
"state",
")",
"{",
"var",
"self",
"=",
"this",
",",
"documentElement",
"=",
"document",
".",
"documentElement",
",",
"slowRendering",
",",
"prefix",
"=",
"self",
".",
"classPrefix",
",",
"layoutRect",
";",
"if",
"(",
"state",
"!=",
"self",
".",
"_fullscreen",
")",
"{",
"$",
"(",
"window",
")",
".",
"on",
"(",
"'resize'",
",",
"function",
"(",
")",
"{",
"var",
"time",
";",
"if",
"(",
"self",
".",
"_fullscreen",
")",
"{",
"// Time the layout time if it's to slow use a timeout to not hog the CPU",
"if",
"(",
"!",
"slowRendering",
")",
"{",
"time",
"=",
"new",
"Date",
"(",
")",
".",
"getTime",
"(",
")",
";",
"var",
"rect",
"=",
"DomUtils",
".",
"getWindowSize",
"(",
")",
";",
"self",
".",
"moveTo",
"(",
"0",
",",
"0",
")",
".",
"resizeTo",
"(",
"rect",
".",
"w",
",",
"rect",
".",
"h",
")",
";",
"if",
"(",
"(",
"new",
"Date",
"(",
")",
".",
"getTime",
"(",
")",
")",
"-",
"time",
">",
"50",
")",
"{",
"slowRendering",
"=",
"true",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"!",
"self",
".",
"_timer",
")",
"{",
"self",
".",
"_timer",
"=",
"Delay",
".",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"var",
"rect",
"=",
"DomUtils",
".",
"getWindowSize",
"(",
")",
";",
"self",
".",
"moveTo",
"(",
"0",
",",
"0",
")",
".",
"resizeTo",
"(",
"rect",
".",
"w",
",",
"rect",
".",
"h",
")",
";",
"self",
".",
"_timer",
"=",
"0",
";",
"}",
",",
"50",
")",
";",
"}",
"}",
"}",
"}",
")",
";",
"layoutRect",
"=",
"self",
".",
"layoutRect",
"(",
")",
";",
"self",
".",
"_fullscreen",
"=",
"state",
";",
"if",
"(",
"!",
"state",
")",
"{",
"self",
".",
"borderBox",
"=",
"BoxUtils",
".",
"parseBox",
"(",
"self",
".",
"settings",
".",
"border",
")",
";",
"self",
".",
"getEl",
"(",
"'head'",
")",
".",
"style",
".",
"display",
"=",
"''",
";",
"layoutRect",
".",
"deltaH",
"+=",
"layoutRect",
".",
"headerH",
";",
"$",
"(",
"[",
"documentElement",
",",
"document",
".",
"body",
"]",
")",
".",
"removeClass",
"(",
"prefix",
"+",
"'fullscreen'",
")",
";",
"self",
".",
"classes",
".",
"remove",
"(",
"'fullscreen'",
")",
";",
"self",
".",
"moveTo",
"(",
"self",
".",
"_initial",
".",
"x",
",",
"self",
".",
"_initial",
".",
"y",
")",
".",
"resizeTo",
"(",
"self",
".",
"_initial",
".",
"w",
",",
"self",
".",
"_initial",
".",
"h",
")",
";",
"}",
"else",
"{",
"self",
".",
"_initial",
"=",
"{",
"x",
":",
"layoutRect",
".",
"x",
",",
"y",
":",
"layoutRect",
".",
"y",
",",
"w",
":",
"layoutRect",
".",
"w",
",",
"h",
":",
"layoutRect",
".",
"h",
"}",
";",
"self",
".",
"borderBox",
"=",
"BoxUtils",
".",
"parseBox",
"(",
"'0'",
")",
";",
"self",
".",
"getEl",
"(",
"'head'",
")",
".",
"style",
".",
"display",
"=",
"'none'",
";",
"layoutRect",
".",
"deltaH",
"-=",
"layoutRect",
".",
"headerH",
"+",
"2",
";",
"$",
"(",
"[",
"documentElement",
",",
"document",
".",
"body",
"]",
")",
".",
"addClass",
"(",
"prefix",
"+",
"'fullscreen'",
")",
";",
"self",
".",
"classes",
".",
"add",
"(",
"'fullscreen'",
")",
";",
"var",
"rect",
"=",
"DomUtils",
".",
"getWindowSize",
"(",
")",
";",
"self",
".",
"moveTo",
"(",
"0",
",",
"0",
")",
".",
"resizeTo",
"(",
"rect",
".",
"w",
",",
"rect",
".",
"h",
")",
";",
"}",
"}",
"return",
"self",
".",
"reflow",
"(",
")",
";",
"}"
] | Switches the window fullscreen mode.
@method fullscreen
@param {Boolean} state True/false state.
@return {tinymce.ui.Window} Current window instance. | [
"Switches",
"the",
"window",
"fullscreen",
"mode",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L30631-L30687 |
|
48,276 | sadiqhabib/tinymce-dist | tinymce.full.js | function (settings) {
var buttons, callback = settings.callback || function () { };
function createButton(text, status, primary) {
return {
type: "button",
text: text,
subtype: primary ? 'primary' : '',
onClick: function (e) {
e.control.parents()[1].close();
callback(status);
}
};
}
switch (settings.buttons) {
case MessageBox.OK_CANCEL:
buttons = [
createButton('Ok', true, true),
createButton('Cancel', false)
];
break;
case MessageBox.YES_NO:
case MessageBox.YES_NO_CANCEL:
buttons = [
createButton('Yes', 1, true),
createButton('No', 0)
];
if (settings.buttons == MessageBox.YES_NO_CANCEL) {
buttons.push(createButton('Cancel', -1));
}
break;
default:
buttons = [
createButton('Ok', true, true)
];
break;
}
return new Window({
padding: 20,
x: settings.x,
y: settings.y,
minWidth: 300,
minHeight: 100,
layout: "flex",
pack: "center",
align: "center",
buttons: buttons,
title: settings.title,
role: 'alertdialog',
items: {
type: "label",
multiline: true,
maxWidth: 500,
maxHeight: 200,
text: settings.text
},
onPostRender: function () {
this.aria('describedby', this.items()[0]._id);
},
onClose: settings.onClose,
onCancel: function () {
callback(false);
}
}).renderTo(document.body).reflow();
} | javascript | function (settings) {
var buttons, callback = settings.callback || function () { };
function createButton(text, status, primary) {
return {
type: "button",
text: text,
subtype: primary ? 'primary' : '',
onClick: function (e) {
e.control.parents()[1].close();
callback(status);
}
};
}
switch (settings.buttons) {
case MessageBox.OK_CANCEL:
buttons = [
createButton('Ok', true, true),
createButton('Cancel', false)
];
break;
case MessageBox.YES_NO:
case MessageBox.YES_NO_CANCEL:
buttons = [
createButton('Yes', 1, true),
createButton('No', 0)
];
if (settings.buttons == MessageBox.YES_NO_CANCEL) {
buttons.push(createButton('Cancel', -1));
}
break;
default:
buttons = [
createButton('Ok', true, true)
];
break;
}
return new Window({
padding: 20,
x: settings.x,
y: settings.y,
minWidth: 300,
minHeight: 100,
layout: "flex",
pack: "center",
align: "center",
buttons: buttons,
title: settings.title,
role: 'alertdialog',
items: {
type: "label",
multiline: true,
maxWidth: 500,
maxHeight: 200,
text: settings.text
},
onPostRender: function () {
this.aria('describedby', this.items()[0]._id);
},
onClose: settings.onClose,
onCancel: function () {
callback(false);
}
}).renderTo(document.body).reflow();
} | [
"function",
"(",
"settings",
")",
"{",
"var",
"buttons",
",",
"callback",
"=",
"settings",
".",
"callback",
"||",
"function",
"(",
")",
"{",
"}",
";",
"function",
"createButton",
"(",
"text",
",",
"status",
",",
"primary",
")",
"{",
"return",
"{",
"type",
":",
"\"button\"",
",",
"text",
":",
"text",
",",
"subtype",
":",
"primary",
"?",
"'primary'",
":",
"''",
",",
"onClick",
":",
"function",
"(",
"e",
")",
"{",
"e",
".",
"control",
".",
"parents",
"(",
")",
"[",
"1",
"]",
".",
"close",
"(",
")",
";",
"callback",
"(",
"status",
")",
";",
"}",
"}",
";",
"}",
"switch",
"(",
"settings",
".",
"buttons",
")",
"{",
"case",
"MessageBox",
".",
"OK_CANCEL",
":",
"buttons",
"=",
"[",
"createButton",
"(",
"'Ok'",
",",
"true",
",",
"true",
")",
",",
"createButton",
"(",
"'Cancel'",
",",
"false",
")",
"]",
";",
"break",
";",
"case",
"MessageBox",
".",
"YES_NO",
":",
"case",
"MessageBox",
".",
"YES_NO_CANCEL",
":",
"buttons",
"=",
"[",
"createButton",
"(",
"'Yes'",
",",
"1",
",",
"true",
")",
",",
"createButton",
"(",
"'No'",
",",
"0",
")",
"]",
";",
"if",
"(",
"settings",
".",
"buttons",
"==",
"MessageBox",
".",
"YES_NO_CANCEL",
")",
"{",
"buttons",
".",
"push",
"(",
"createButton",
"(",
"'Cancel'",
",",
"-",
"1",
")",
")",
";",
"}",
"break",
";",
"default",
":",
"buttons",
"=",
"[",
"createButton",
"(",
"'Ok'",
",",
"true",
",",
"true",
")",
"]",
";",
"break",
";",
"}",
"return",
"new",
"Window",
"(",
"{",
"padding",
":",
"20",
",",
"x",
":",
"settings",
".",
"x",
",",
"y",
":",
"settings",
".",
"y",
",",
"minWidth",
":",
"300",
",",
"minHeight",
":",
"100",
",",
"layout",
":",
"\"flex\"",
",",
"pack",
":",
"\"center\"",
",",
"align",
":",
"\"center\"",
",",
"buttons",
":",
"buttons",
",",
"title",
":",
"settings",
".",
"title",
",",
"role",
":",
"'alertdialog'",
",",
"items",
":",
"{",
"type",
":",
"\"label\"",
",",
"multiline",
":",
"true",
",",
"maxWidth",
":",
"500",
",",
"maxHeight",
":",
"200",
",",
"text",
":",
"settings",
".",
"text",
"}",
",",
"onPostRender",
":",
"function",
"(",
")",
"{",
"this",
".",
"aria",
"(",
"'describedby'",
",",
"this",
".",
"items",
"(",
")",
"[",
"0",
"]",
".",
"_id",
")",
";",
"}",
",",
"onClose",
":",
"settings",
".",
"onClose",
",",
"onCancel",
":",
"function",
"(",
")",
"{",
"callback",
"(",
"false",
")",
";",
"}",
"}",
")",
".",
"renderTo",
"(",
"document",
".",
"body",
")",
".",
"reflow",
"(",
")",
";",
"}"
] | Constructs a new message box and renders it to the body element.
@static
@method msgBox
@param {Object} settings Name/value object with settings. | [
"Constructs",
"a",
"new",
"message",
"box",
"and",
"renders",
"it",
"to",
"the",
"body",
"element",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L30884-L30953 |
|
48,277 | sadiqhabib/tinymce-dist | tinymce.full.js | function (settings, callback) {
if (typeof settings == "string") {
settings = { text: settings };
}
settings.callback = callback;
return MessageBox.msgBox(settings);
} | javascript | function (settings, callback) {
if (typeof settings == "string") {
settings = { text: settings };
}
settings.callback = callback;
return MessageBox.msgBox(settings);
} | [
"function",
"(",
"settings",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"settings",
"==",
"\"string\"",
")",
"{",
"settings",
"=",
"{",
"text",
":",
"settings",
"}",
";",
"}",
"settings",
".",
"callback",
"=",
"callback",
";",
"return",
"MessageBox",
".",
"msgBox",
"(",
"settings",
")",
";",
"}"
] | Creates a new alert dialog.
@method alert
@param {Object} settings Settings for the alert dialog.
@param {function} [callback] Callback to execute when the user makes a choice. | [
"Creates",
"a",
"new",
"alert",
"dialog",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L30962-L30969 |
|
48,278 | sadiqhabib/tinymce-dist | tinymce.full.js | function (settings, callback) {
if (typeof settings == "string") {
settings = { text: settings };
}
settings.callback = callback;
settings.buttons = MessageBox.OK_CANCEL;
return MessageBox.msgBox(settings);
} | javascript | function (settings, callback) {
if (typeof settings == "string") {
settings = { text: settings };
}
settings.callback = callback;
settings.buttons = MessageBox.OK_CANCEL;
return MessageBox.msgBox(settings);
} | [
"function",
"(",
"settings",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"settings",
"==",
"\"string\"",
")",
"{",
"settings",
"=",
"{",
"text",
":",
"settings",
"}",
";",
"}",
"settings",
".",
"callback",
"=",
"callback",
";",
"settings",
".",
"buttons",
"=",
"MessageBox",
".",
"OK_CANCEL",
";",
"return",
"MessageBox",
".",
"msgBox",
"(",
"settings",
")",
";",
"}"
] | Creates a new confirm dialog.
@method confirm
@param {Object} settings Settings for the confirm dialog.
@param {function} [callback] Callback to execute when the user makes a choice. | [
"Creates",
"a",
"new",
"confirm",
"dialog",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L30978-L30987 |
|
48,279 | sadiqhabib/tinymce-dist | tinymce.full.js | findDuplicateMessage | function findDuplicateMessage(notificationArray, newNotification) {
if (!isPlainTextNotification(newNotification)) {
return null;
}
var filteredNotifications = Tools.grep(notificationArray, function (notification) {
return isSameNotification(newNotification, notification);
});
return filteredNotifications.length === 0 ? null : filteredNotifications[0];
} | javascript | function findDuplicateMessage(notificationArray, newNotification) {
if (!isPlainTextNotification(newNotification)) {
return null;
}
var filteredNotifications = Tools.grep(notificationArray, function (notification) {
return isSameNotification(newNotification, notification);
});
return filteredNotifications.length === 0 ? null : filteredNotifications[0];
} | [
"function",
"findDuplicateMessage",
"(",
"notificationArray",
",",
"newNotification",
")",
"{",
"if",
"(",
"!",
"isPlainTextNotification",
"(",
"newNotification",
")",
")",
"{",
"return",
"null",
";",
"}",
"var",
"filteredNotifications",
"=",
"Tools",
".",
"grep",
"(",
"notificationArray",
",",
"function",
"(",
"notification",
")",
"{",
"return",
"isSameNotification",
"(",
"newNotification",
",",
"notification",
")",
";",
"}",
")",
";",
"return",
"filteredNotifications",
".",
"length",
"===",
"0",
"?",
"null",
":",
"filteredNotifications",
"[",
"0",
"]",
";",
"}"
] | Finds any existing notification with the same properties as the new one.
Returns either the found notification or null.
@param {Notification[]} notificationArray - Array of current notifications
@param {type: string, } newNotification - New notification object
@returns {?Notification} | [
"Finds",
"any",
"existing",
"notification",
"with",
"the",
"same",
"properties",
"as",
"the",
"new",
"one",
".",
"Returns",
"either",
"the",
"found",
"notification",
"or",
"null",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L31937-L31947 |
48,280 | sadiqhabib/tinymce-dist | tinymce.full.js | isSameNotification | function isSameNotification(a, b) {
return a.type === b.settings.type && a.text === b.settings.text;
} | javascript | function isSameNotification(a, b) {
return a.type === b.settings.type && a.text === b.settings.text;
} | [
"function",
"isSameNotification",
"(",
"a",
",",
"b",
")",
"{",
"return",
"a",
".",
"type",
"===",
"b",
".",
"settings",
".",
"type",
"&&",
"a",
".",
"text",
"===",
"b",
".",
"settings",
".",
"text",
";",
"}"
] | Checks if the passed in args object has the same
type and text properties as the sent in notification.
@param {type: string, text: string} a - New notification args object
@param {Notification} b - Old notification
@returns {boolean} | [
"Checks",
"if",
"the",
"passed",
"in",
"args",
"object",
"has",
"the",
"same",
"type",
"and",
"text",
"properties",
"as",
"the",
"sent",
"in",
"notification",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L31957-L31959 |
48,281 | sadiqhabib/tinymce-dist | tinymce.full.js | getEventTarget | function getEventTarget(editor, eventName) {
if (eventName == 'selectionchange') {
return editor.getDoc();
}
// Need to bind mousedown/mouseup etc to document not body in iframe mode
// Since the user might click on the HTML element not the BODY
if (!editor.inline && /^mouse|touch|click|contextmenu|drop|dragover|dragend/.test(eventName)) {
return editor.getDoc().documentElement;
}
// Bind to event root instead of body if it's defined
if (editor.settings.event_root) {
if (!editor.eventRoot) {
editor.eventRoot = DOM.select(editor.settings.event_root)[0];
}
return editor.eventRoot;
}
return editor.getBody();
} | javascript | function getEventTarget(editor, eventName) {
if (eventName == 'selectionchange') {
return editor.getDoc();
}
// Need to bind mousedown/mouseup etc to document not body in iframe mode
// Since the user might click on the HTML element not the BODY
if (!editor.inline && /^mouse|touch|click|contextmenu|drop|dragover|dragend/.test(eventName)) {
return editor.getDoc().documentElement;
}
// Bind to event root instead of body if it's defined
if (editor.settings.event_root) {
if (!editor.eventRoot) {
editor.eventRoot = DOM.select(editor.settings.event_root)[0];
}
return editor.eventRoot;
}
return editor.getBody();
} | [
"function",
"getEventTarget",
"(",
"editor",
",",
"eventName",
")",
"{",
"if",
"(",
"eventName",
"==",
"'selectionchange'",
")",
"{",
"return",
"editor",
".",
"getDoc",
"(",
")",
";",
"}",
"// Need to bind mousedown/mouseup etc to document not body in iframe mode",
"// Since the user might click on the HTML element not the BODY",
"if",
"(",
"!",
"editor",
".",
"inline",
"&&",
"/",
"^mouse|touch|click|contextmenu|drop|dragover|dragend",
"/",
".",
"test",
"(",
"eventName",
")",
")",
"{",
"return",
"editor",
".",
"getDoc",
"(",
")",
".",
"documentElement",
";",
"}",
"// Bind to event root instead of body if it's defined",
"if",
"(",
"editor",
".",
"settings",
".",
"event_root",
")",
"{",
"if",
"(",
"!",
"editor",
".",
"eventRoot",
")",
"{",
"editor",
".",
"eventRoot",
"=",
"DOM",
".",
"select",
"(",
"editor",
".",
"settings",
".",
"event_root",
")",
"[",
"0",
"]",
";",
"}",
"return",
"editor",
".",
"eventRoot",
";",
"}",
"return",
"editor",
".",
"getBody",
"(",
")",
";",
"}"
] | Returns the event target so for the specified event. Some events fire
only on document, some fire on documentElement etc. This also handles the
custom event root setting where it returns that element instead of the body.
@private
@param {tinymce.Editor} editor Editor instance to get event target from.
@param {String} eventName Name of the event for example "click".
@return {Element/Document} HTML Element or document target to bind on. | [
"Returns",
"the",
"event",
"target",
"so",
"for",
"the",
"specified",
"event",
".",
"Some",
"events",
"fire",
"only",
"on",
"document",
"some",
"fire",
"on",
"documentElement",
"etc",
".",
"This",
"also",
"handles",
"the",
"custom",
"event",
"root",
"setting",
"where",
"it",
"returns",
"that",
"element",
"instead",
"of",
"the",
"body",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L32013-L32034 |
48,282 | sadiqhabib/tinymce-dist | tinymce.full.js | bindEventDelegate | function bindEventDelegate(editor, eventName) {
var eventRootElm = getEventTarget(editor, eventName), delegate;
function isListening(editor) {
return !editor.hidden && !editor.readonly;
}
if (!editor.delegates) {
editor.delegates = {};
}
if (editor.delegates[eventName]) {
return;
}
if (editor.settings.event_root) {
if (!customEventRootDelegates) {
customEventRootDelegates = {};
editor.editorManager.on('removeEditor', function () {
var name;
if (!editor.editorManager.activeEditor) {
if (customEventRootDelegates) {
for (name in customEventRootDelegates) {
editor.dom.unbind(getEventTarget(editor, name));
}
customEventRootDelegates = null;
}
}
});
}
if (customEventRootDelegates[eventName]) {
return;
}
delegate = function (e) {
var target = e.target, editors = editor.editorManager.editors, i = editors.length;
while (i--) {
var body = editors[i].getBody();
if (body === target || DOM.isChildOf(target, body)) {
if (isListening(editors[i])) {
editors[i].fire(eventName, e);
}
}
}
};
customEventRootDelegates[eventName] = delegate;
DOM.bind(eventRootElm, eventName, delegate);
} else {
delegate = function (e) {
if (isListening(editor)) {
editor.fire(eventName, e);
}
};
DOM.bind(eventRootElm, eventName, delegate);
editor.delegates[eventName] = delegate;
}
} | javascript | function bindEventDelegate(editor, eventName) {
var eventRootElm = getEventTarget(editor, eventName), delegate;
function isListening(editor) {
return !editor.hidden && !editor.readonly;
}
if (!editor.delegates) {
editor.delegates = {};
}
if (editor.delegates[eventName]) {
return;
}
if (editor.settings.event_root) {
if (!customEventRootDelegates) {
customEventRootDelegates = {};
editor.editorManager.on('removeEditor', function () {
var name;
if (!editor.editorManager.activeEditor) {
if (customEventRootDelegates) {
for (name in customEventRootDelegates) {
editor.dom.unbind(getEventTarget(editor, name));
}
customEventRootDelegates = null;
}
}
});
}
if (customEventRootDelegates[eventName]) {
return;
}
delegate = function (e) {
var target = e.target, editors = editor.editorManager.editors, i = editors.length;
while (i--) {
var body = editors[i].getBody();
if (body === target || DOM.isChildOf(target, body)) {
if (isListening(editors[i])) {
editors[i].fire(eventName, e);
}
}
}
};
customEventRootDelegates[eventName] = delegate;
DOM.bind(eventRootElm, eventName, delegate);
} else {
delegate = function (e) {
if (isListening(editor)) {
editor.fire(eventName, e);
}
};
DOM.bind(eventRootElm, eventName, delegate);
editor.delegates[eventName] = delegate;
}
} | [
"function",
"bindEventDelegate",
"(",
"editor",
",",
"eventName",
")",
"{",
"var",
"eventRootElm",
"=",
"getEventTarget",
"(",
"editor",
",",
"eventName",
")",
",",
"delegate",
";",
"function",
"isListening",
"(",
"editor",
")",
"{",
"return",
"!",
"editor",
".",
"hidden",
"&&",
"!",
"editor",
".",
"readonly",
";",
"}",
"if",
"(",
"!",
"editor",
".",
"delegates",
")",
"{",
"editor",
".",
"delegates",
"=",
"{",
"}",
";",
"}",
"if",
"(",
"editor",
".",
"delegates",
"[",
"eventName",
"]",
")",
"{",
"return",
";",
"}",
"if",
"(",
"editor",
".",
"settings",
".",
"event_root",
")",
"{",
"if",
"(",
"!",
"customEventRootDelegates",
")",
"{",
"customEventRootDelegates",
"=",
"{",
"}",
";",
"editor",
".",
"editorManager",
".",
"on",
"(",
"'removeEditor'",
",",
"function",
"(",
")",
"{",
"var",
"name",
";",
"if",
"(",
"!",
"editor",
".",
"editorManager",
".",
"activeEditor",
")",
"{",
"if",
"(",
"customEventRootDelegates",
")",
"{",
"for",
"(",
"name",
"in",
"customEventRootDelegates",
")",
"{",
"editor",
".",
"dom",
".",
"unbind",
"(",
"getEventTarget",
"(",
"editor",
",",
"name",
")",
")",
";",
"}",
"customEventRootDelegates",
"=",
"null",
";",
"}",
"}",
"}",
")",
";",
"}",
"if",
"(",
"customEventRootDelegates",
"[",
"eventName",
"]",
")",
"{",
"return",
";",
"}",
"delegate",
"=",
"function",
"(",
"e",
")",
"{",
"var",
"target",
"=",
"e",
".",
"target",
",",
"editors",
"=",
"editor",
".",
"editorManager",
".",
"editors",
",",
"i",
"=",
"editors",
".",
"length",
";",
"while",
"(",
"i",
"--",
")",
"{",
"var",
"body",
"=",
"editors",
"[",
"i",
"]",
".",
"getBody",
"(",
")",
";",
"if",
"(",
"body",
"===",
"target",
"||",
"DOM",
".",
"isChildOf",
"(",
"target",
",",
"body",
")",
")",
"{",
"if",
"(",
"isListening",
"(",
"editors",
"[",
"i",
"]",
")",
")",
"{",
"editors",
"[",
"i",
"]",
".",
"fire",
"(",
"eventName",
",",
"e",
")",
";",
"}",
"}",
"}",
"}",
";",
"customEventRootDelegates",
"[",
"eventName",
"]",
"=",
"delegate",
";",
"DOM",
".",
"bind",
"(",
"eventRootElm",
",",
"eventName",
",",
"delegate",
")",
";",
"}",
"else",
"{",
"delegate",
"=",
"function",
"(",
"e",
")",
"{",
"if",
"(",
"isListening",
"(",
"editor",
")",
")",
"{",
"editor",
".",
"fire",
"(",
"eventName",
",",
"e",
")",
";",
"}",
"}",
";",
"DOM",
".",
"bind",
"(",
"eventRootElm",
",",
"eventName",
",",
"delegate",
")",
";",
"editor",
".",
"delegates",
"[",
"eventName",
"]",
"=",
"delegate",
";",
"}",
"}"
] | Binds a event delegate for the specified name this delegate will fire
the event to the editor dispatcher.
@private
@param {tinymce.Editor} editor Editor instance to get event target from.
@param {String} eventName Name of the event for example "click". | [
"Binds",
"a",
"event",
"delegate",
"for",
"the",
"specified",
"name",
"this",
"delegate",
"will",
"fire",
"the",
"event",
"to",
"the",
"editor",
"dispatcher",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L32044-L32107 |
48,283 | sadiqhabib/tinymce-dist | tinymce.full.js | function () {
var self = this, name;
if (self.delegates) {
for (name in self.delegates) {
self.dom.unbind(getEventTarget(self, name), name, self.delegates[name]);
}
delete self.delegates;
}
if (!self.inline) {
self.getBody().onload = null;
self.dom.unbind(self.getWin());
self.dom.unbind(self.getDoc());
}
self.dom.unbind(self.getBody());
self.dom.unbind(self.getContainer());
} | javascript | function () {
var self = this, name;
if (self.delegates) {
for (name in self.delegates) {
self.dom.unbind(getEventTarget(self, name), name, self.delegates[name]);
}
delete self.delegates;
}
if (!self.inline) {
self.getBody().onload = null;
self.dom.unbind(self.getWin());
self.dom.unbind(self.getDoc());
}
self.dom.unbind(self.getBody());
self.dom.unbind(self.getContainer());
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
",",
"name",
";",
"if",
"(",
"self",
".",
"delegates",
")",
"{",
"for",
"(",
"name",
"in",
"self",
".",
"delegates",
")",
"{",
"self",
".",
"dom",
".",
"unbind",
"(",
"getEventTarget",
"(",
"self",
",",
"name",
")",
",",
"name",
",",
"self",
".",
"delegates",
"[",
"name",
"]",
")",
";",
"}",
"delete",
"self",
".",
"delegates",
";",
"}",
"if",
"(",
"!",
"self",
".",
"inline",
")",
"{",
"self",
".",
"getBody",
"(",
")",
".",
"onload",
"=",
"null",
";",
"self",
".",
"dom",
".",
"unbind",
"(",
"self",
".",
"getWin",
"(",
")",
")",
";",
"self",
".",
"dom",
".",
"unbind",
"(",
"self",
".",
"getDoc",
"(",
")",
")",
";",
"}",
"self",
".",
"dom",
".",
"unbind",
"(",
"self",
".",
"getBody",
"(",
")",
")",
";",
"self",
".",
"dom",
".",
"unbind",
"(",
"self",
".",
"getContainer",
"(",
")",
")",
";",
"}"
] | Unbinds all native event handlers that means delegates, custom events bound using the Events API etc.
@private | [
"Unbinds",
"all",
"native",
"event",
"handlers",
"that",
"means",
"delegates",
"custom",
"events",
"bound",
"using",
"the",
"Events",
"API",
"etc",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L32158-L32177 |
|
48,284 | sadiqhabib/tinymce-dist | tinymce.full.js | createNewBlock | function createNewBlock(name) {
var node = container, block, clonedNode, caretNode, textInlineElements = schema.getTextInlineElements();
if (name || parentBlockName == "TABLE") {
block = dom.create(name || newBlockName);
setForcedBlockAttrs(block);
} else {
block = parentBlock.cloneNode(false);
}
caretNode = block;
// Clone any parent styles
if (settings.keep_styles !== false) {
do {
if (textInlineElements[node.nodeName]) {
// Never clone a caret containers
if (node.id == '_mce_caret') {
continue;
}
clonedNode = node.cloneNode(false);
dom.setAttrib(clonedNode, 'id', ''); // Remove ID since it needs to be document unique
if (block.hasChildNodes()) {
clonedNode.appendChild(block.firstChild);
block.appendChild(clonedNode);
} else {
caretNode = clonedNode;
block.appendChild(clonedNode);
}
}
} while ((node = node.parentNode) && node != editableRoot);
}
// BR is needed in empty blocks on non IE browsers
if (!isIE) {
caretNode.innerHTML = '<br data-mce-bogus="1">';
}
return block;
} | javascript | function createNewBlock(name) {
var node = container, block, clonedNode, caretNode, textInlineElements = schema.getTextInlineElements();
if (name || parentBlockName == "TABLE") {
block = dom.create(name || newBlockName);
setForcedBlockAttrs(block);
} else {
block = parentBlock.cloneNode(false);
}
caretNode = block;
// Clone any parent styles
if (settings.keep_styles !== false) {
do {
if (textInlineElements[node.nodeName]) {
// Never clone a caret containers
if (node.id == '_mce_caret') {
continue;
}
clonedNode = node.cloneNode(false);
dom.setAttrib(clonedNode, 'id', ''); // Remove ID since it needs to be document unique
if (block.hasChildNodes()) {
clonedNode.appendChild(block.firstChild);
block.appendChild(clonedNode);
} else {
caretNode = clonedNode;
block.appendChild(clonedNode);
}
}
} while ((node = node.parentNode) && node != editableRoot);
}
// BR is needed in empty blocks on non IE browsers
if (!isIE) {
caretNode.innerHTML = '<br data-mce-bogus="1">';
}
return block;
} | [
"function",
"createNewBlock",
"(",
"name",
")",
"{",
"var",
"node",
"=",
"container",
",",
"block",
",",
"clonedNode",
",",
"caretNode",
",",
"textInlineElements",
"=",
"schema",
".",
"getTextInlineElements",
"(",
")",
";",
"if",
"(",
"name",
"||",
"parentBlockName",
"==",
"\"TABLE\"",
")",
"{",
"block",
"=",
"dom",
".",
"create",
"(",
"name",
"||",
"newBlockName",
")",
";",
"setForcedBlockAttrs",
"(",
"block",
")",
";",
"}",
"else",
"{",
"block",
"=",
"parentBlock",
".",
"cloneNode",
"(",
"false",
")",
";",
"}",
"caretNode",
"=",
"block",
";",
"// Clone any parent styles",
"if",
"(",
"settings",
".",
"keep_styles",
"!==",
"false",
")",
"{",
"do",
"{",
"if",
"(",
"textInlineElements",
"[",
"node",
".",
"nodeName",
"]",
")",
"{",
"// Never clone a caret containers",
"if",
"(",
"node",
".",
"id",
"==",
"'_mce_caret'",
")",
"{",
"continue",
";",
"}",
"clonedNode",
"=",
"node",
".",
"cloneNode",
"(",
"false",
")",
";",
"dom",
".",
"setAttrib",
"(",
"clonedNode",
",",
"'id'",
",",
"''",
")",
";",
"// Remove ID since it needs to be document unique",
"if",
"(",
"block",
".",
"hasChildNodes",
"(",
")",
")",
"{",
"clonedNode",
".",
"appendChild",
"(",
"block",
".",
"firstChild",
")",
";",
"block",
".",
"appendChild",
"(",
"clonedNode",
")",
";",
"}",
"else",
"{",
"caretNode",
"=",
"clonedNode",
";",
"block",
".",
"appendChild",
"(",
"clonedNode",
")",
";",
"}",
"}",
"}",
"while",
"(",
"(",
"node",
"=",
"node",
".",
"parentNode",
")",
"&&",
"node",
"!=",
"editableRoot",
")",
";",
"}",
"// BR is needed in empty blocks on non IE browsers",
"if",
"(",
"!",
"isIE",
")",
"{",
"caretNode",
".",
"innerHTML",
"=",
"'<br data-mce-bogus=\"1\">'",
";",
"}",
"return",
"block",
";",
"}"
] | Creates a new block element by cloning the current one or creating a new one if the name is specified This function will also copy any text formatting from the parent block and add it to the new one | [
"Creates",
"a",
"new",
"block",
"element",
"by",
"cloning",
"the",
"current",
"one",
"or",
"creating",
"a",
"new",
"one",
"if",
"the",
"name",
"is",
"specified",
"This",
"function",
"will",
"also",
"copy",
"any",
"text",
"formatting",
"from",
"the",
"parent",
"block",
"and",
"add",
"it",
"to",
"the",
"new",
"one"
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L32783-L32824 |
48,285 | sadiqhabib/tinymce-dist | tinymce.full.js | wrapSelfAndSiblingsInDefaultBlock | function wrapSelfAndSiblingsInDefaultBlock(container, offset) {
var newBlock, parentBlock, startNode, node, next, rootBlockName, blockName = newBlockName || 'P';
// Not in a block element or in a table cell or caption
parentBlock = dom.getParent(container, dom.isBlock);
if (!parentBlock || !canSplitBlock(parentBlock)) {
parentBlock = parentBlock || editableRoot;
if (parentBlock == editor.getBody() || isTableCell(parentBlock)) {
rootBlockName = parentBlock.nodeName.toLowerCase();
} else {
rootBlockName = parentBlock.parentNode.nodeName.toLowerCase();
}
if (!parentBlock.hasChildNodes()) {
newBlock = dom.create(blockName);
setForcedBlockAttrs(newBlock);
parentBlock.appendChild(newBlock);
rng.setStart(newBlock, 0);
rng.setEnd(newBlock, 0);
return newBlock;
}
// Find parent that is the first child of parentBlock
node = container;
while (node.parentNode != parentBlock) {
node = node.parentNode;
}
// Loop left to find start node start wrapping at
while (node && !dom.isBlock(node)) {
startNode = node;
node = node.previousSibling;
}
if (startNode && schema.isValidChild(rootBlockName, blockName.toLowerCase())) {
newBlock = dom.create(blockName);
setForcedBlockAttrs(newBlock);
startNode.parentNode.insertBefore(newBlock, startNode);
// Start wrapping until we hit a block
node = startNode;
while (node && !dom.isBlock(node)) {
next = node.nextSibling;
newBlock.appendChild(node);
node = next;
}
// Restore range to it's past location
rng.setStart(container, offset);
rng.setEnd(container, offset);
}
}
return container;
} | javascript | function wrapSelfAndSiblingsInDefaultBlock(container, offset) {
var newBlock, parentBlock, startNode, node, next, rootBlockName, blockName = newBlockName || 'P';
// Not in a block element or in a table cell or caption
parentBlock = dom.getParent(container, dom.isBlock);
if (!parentBlock || !canSplitBlock(parentBlock)) {
parentBlock = parentBlock || editableRoot;
if (parentBlock == editor.getBody() || isTableCell(parentBlock)) {
rootBlockName = parentBlock.nodeName.toLowerCase();
} else {
rootBlockName = parentBlock.parentNode.nodeName.toLowerCase();
}
if (!parentBlock.hasChildNodes()) {
newBlock = dom.create(blockName);
setForcedBlockAttrs(newBlock);
parentBlock.appendChild(newBlock);
rng.setStart(newBlock, 0);
rng.setEnd(newBlock, 0);
return newBlock;
}
// Find parent that is the first child of parentBlock
node = container;
while (node.parentNode != parentBlock) {
node = node.parentNode;
}
// Loop left to find start node start wrapping at
while (node && !dom.isBlock(node)) {
startNode = node;
node = node.previousSibling;
}
if (startNode && schema.isValidChild(rootBlockName, blockName.toLowerCase())) {
newBlock = dom.create(blockName);
setForcedBlockAttrs(newBlock);
startNode.parentNode.insertBefore(newBlock, startNode);
// Start wrapping until we hit a block
node = startNode;
while (node && !dom.isBlock(node)) {
next = node.nextSibling;
newBlock.appendChild(node);
node = next;
}
// Restore range to it's past location
rng.setStart(container, offset);
rng.setEnd(container, offset);
}
}
return container;
} | [
"function",
"wrapSelfAndSiblingsInDefaultBlock",
"(",
"container",
",",
"offset",
")",
"{",
"var",
"newBlock",
",",
"parentBlock",
",",
"startNode",
",",
"node",
",",
"next",
",",
"rootBlockName",
",",
"blockName",
"=",
"newBlockName",
"||",
"'P'",
";",
"// Not in a block element or in a table cell or caption",
"parentBlock",
"=",
"dom",
".",
"getParent",
"(",
"container",
",",
"dom",
".",
"isBlock",
")",
";",
"if",
"(",
"!",
"parentBlock",
"||",
"!",
"canSplitBlock",
"(",
"parentBlock",
")",
")",
"{",
"parentBlock",
"=",
"parentBlock",
"||",
"editableRoot",
";",
"if",
"(",
"parentBlock",
"==",
"editor",
".",
"getBody",
"(",
")",
"||",
"isTableCell",
"(",
"parentBlock",
")",
")",
"{",
"rootBlockName",
"=",
"parentBlock",
".",
"nodeName",
".",
"toLowerCase",
"(",
")",
";",
"}",
"else",
"{",
"rootBlockName",
"=",
"parentBlock",
".",
"parentNode",
".",
"nodeName",
".",
"toLowerCase",
"(",
")",
";",
"}",
"if",
"(",
"!",
"parentBlock",
".",
"hasChildNodes",
"(",
")",
")",
"{",
"newBlock",
"=",
"dom",
".",
"create",
"(",
"blockName",
")",
";",
"setForcedBlockAttrs",
"(",
"newBlock",
")",
";",
"parentBlock",
".",
"appendChild",
"(",
"newBlock",
")",
";",
"rng",
".",
"setStart",
"(",
"newBlock",
",",
"0",
")",
";",
"rng",
".",
"setEnd",
"(",
"newBlock",
",",
"0",
")",
";",
"return",
"newBlock",
";",
"}",
"// Find parent that is the first child of parentBlock",
"node",
"=",
"container",
";",
"while",
"(",
"node",
".",
"parentNode",
"!=",
"parentBlock",
")",
"{",
"node",
"=",
"node",
".",
"parentNode",
";",
"}",
"// Loop left to find start node start wrapping at",
"while",
"(",
"node",
"&&",
"!",
"dom",
".",
"isBlock",
"(",
"node",
")",
")",
"{",
"startNode",
"=",
"node",
";",
"node",
"=",
"node",
".",
"previousSibling",
";",
"}",
"if",
"(",
"startNode",
"&&",
"schema",
".",
"isValidChild",
"(",
"rootBlockName",
",",
"blockName",
".",
"toLowerCase",
"(",
")",
")",
")",
"{",
"newBlock",
"=",
"dom",
".",
"create",
"(",
"blockName",
")",
";",
"setForcedBlockAttrs",
"(",
"newBlock",
")",
";",
"startNode",
".",
"parentNode",
".",
"insertBefore",
"(",
"newBlock",
",",
"startNode",
")",
";",
"// Start wrapping until we hit a block",
"node",
"=",
"startNode",
";",
"while",
"(",
"node",
"&&",
"!",
"dom",
".",
"isBlock",
"(",
"node",
")",
")",
"{",
"next",
"=",
"node",
".",
"nextSibling",
";",
"newBlock",
".",
"appendChild",
"(",
"node",
")",
";",
"node",
"=",
"next",
";",
"}",
"// Restore range to it's past location",
"rng",
".",
"setStart",
"(",
"container",
",",
"offset",
")",
";",
"rng",
".",
"setEnd",
"(",
"container",
",",
"offset",
")",
";",
"}",
"}",
"return",
"container",
";",
"}"
] | Wraps any text nodes or inline elements in the specified forced root block name | [
"Wraps",
"any",
"text",
"nodes",
"or",
"inline",
"elements",
"in",
"the",
"specified",
"forced",
"root",
"block",
"name"
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L32887-L32942 |
48,286 | sadiqhabib/tinymce-dist | tinymce.full.js | trimLeadingLineBreaks | function trimLeadingLineBreaks(node) {
do {
if (node.nodeType === 3) {
node.nodeValue = node.nodeValue.replace(/^[\r\n]+/, '');
}
node = node.firstChild;
} while (node);
} | javascript | function trimLeadingLineBreaks(node) {
do {
if (node.nodeType === 3) {
node.nodeValue = node.nodeValue.replace(/^[\r\n]+/, '');
}
node = node.firstChild;
} while (node);
} | [
"function",
"trimLeadingLineBreaks",
"(",
"node",
")",
"{",
"do",
"{",
"if",
"(",
"node",
".",
"nodeType",
"===",
"3",
")",
"{",
"node",
".",
"nodeValue",
"=",
"node",
".",
"nodeValue",
".",
"replace",
"(",
"/",
"^[\\r\\n]+",
"/",
",",
"''",
")",
";",
"}",
"node",
"=",
"node",
".",
"firstChild",
";",
"}",
"while",
"(",
"node",
")",
";",
"}"
] | Trims any linebreaks at the beginning of node user for example when pressing enter in a PRE element | [
"Trims",
"any",
"linebreaks",
"at",
"the",
"beginning",
"of",
"node",
"user",
"for",
"example",
"when",
"pressing",
"enter",
"in",
"a",
"PRE",
"element"
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L33034-L33042 |
48,287 | sadiqhabib/tinymce-dist | tinymce.full.js | addBrToBlockIfNeeded | function addBrToBlockIfNeeded(block) {
var lastChild;
// IE will render the blocks correctly other browsers needs a BR
if (!isIE) {
block.normalize(); // Remove empty text nodes that got left behind by the extract
// Check if the block is empty or contains a floated last child
lastChild = block.lastChild;
if (!lastChild || (/^(left|right)$/gi.test(dom.getStyle(lastChild, 'float', true)))) {
dom.add(block, 'br');
}
}
} | javascript | function addBrToBlockIfNeeded(block) {
var lastChild;
// IE will render the blocks correctly other browsers needs a BR
if (!isIE) {
block.normalize(); // Remove empty text nodes that got left behind by the extract
// Check if the block is empty or contains a floated last child
lastChild = block.lastChild;
if (!lastChild || (/^(left|right)$/gi.test(dom.getStyle(lastChild, 'float', true)))) {
dom.add(block, 'br');
}
}
} | [
"function",
"addBrToBlockIfNeeded",
"(",
"block",
")",
"{",
"var",
"lastChild",
";",
"// IE will render the blocks correctly other browsers needs a BR",
"if",
"(",
"!",
"isIE",
")",
"{",
"block",
".",
"normalize",
"(",
")",
";",
"// Remove empty text nodes that got left behind by the extract",
"// Check if the block is empty or contains a floated last child",
"lastChild",
"=",
"block",
".",
"lastChild",
";",
"if",
"(",
"!",
"lastChild",
"||",
"(",
"/",
"^(left|right)$",
"/",
"gi",
".",
"test",
"(",
"dom",
".",
"getStyle",
"(",
"lastChild",
",",
"'float'",
",",
"true",
")",
")",
")",
")",
"{",
"dom",
".",
"add",
"(",
"block",
",",
"'br'",
")",
";",
"}",
"}",
"}"
] | Adds a BR at the end of blocks that only contains an IMG or INPUT since these might be floated and then they won't expand the block | [
"Adds",
"a",
"BR",
"at",
"the",
"end",
"of",
"blocks",
"that",
"only",
"contains",
"an",
"IMG",
"or",
"INPUT",
"since",
"these",
"might",
"be",
"floated",
"and",
"then",
"they",
"won",
"t",
"expand",
"the",
"block"
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L33062-L33075 |
48,288 | sadiqhabib/tinymce-dist | tinymce.full.js | insertClipboardContents | function insertClipboardContents(content, internal) {
if (editor.queryCommandSupported('mceInsertClipboardContent')) {
editor.execCommand('mceInsertClipboardContent', false, { content: content, internal: internal });
} else {
editor.execCommand('mceInsertContent', false, content);
}
} | javascript | function insertClipboardContents(content, internal) {
if (editor.queryCommandSupported('mceInsertClipboardContent')) {
editor.execCommand('mceInsertClipboardContent', false, { content: content, internal: internal });
} else {
editor.execCommand('mceInsertContent', false, content);
}
} | [
"function",
"insertClipboardContents",
"(",
"content",
",",
"internal",
")",
"{",
"if",
"(",
"editor",
".",
"queryCommandSupported",
"(",
"'mceInsertClipboardContent'",
")",
")",
"{",
"editor",
".",
"execCommand",
"(",
"'mceInsertClipboardContent'",
",",
"false",
",",
"{",
"content",
":",
"content",
",",
"internal",
":",
"internal",
"}",
")",
";",
"}",
"else",
"{",
"editor",
".",
"execCommand",
"(",
"'mceInsertContent'",
",",
"false",
",",
"content",
")",
";",
"}",
"}"
] | Inserts contents using the paste clipboard command if it's available if it isn't it will fallback
to the core command.
@private
@param {String} content Content to insert at selection.
@param {Boolean} internal State if the paste is to be considered internal or external. | [
"Inserts",
"contents",
"using",
"the",
"paste",
"clipboard",
"command",
"if",
"it",
"s",
"available",
"if",
"it",
"isn",
"t",
"it",
"will",
"fallback",
"to",
"the",
"core",
"command",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L33604-L33610 |
48,289 | sadiqhabib/tinymce-dist | tinymce.full.js | handleLastBlockCharacterDelete | function handleLastBlockCharacterDelete(isForward, rng) {
var path, blockElm, newBlockElm, clonedBlockElm, sibling,
container, offset, br, currentFormatNodes;
function cloneTextBlockWithFormats(blockElm, node) {
currentFormatNodes = $(node).parents().filter(function (idx, node) {
return !!editor.schema.getTextInlineElements()[node.nodeName];
});
newBlockElm = blockElm.cloneNode(false);
currentFormatNodes = Tools.map(currentFormatNodes, function (formatNode) {
formatNode = formatNode.cloneNode(false);
if (newBlockElm.hasChildNodes()) {
formatNode.appendChild(newBlockElm.firstChild);
newBlockElm.appendChild(formatNode);
} else {
newBlockElm.appendChild(formatNode);
}
newBlockElm.appendChild(formatNode);
return formatNode;
});
if (currentFormatNodes.length) {
br = dom.create('br');
currentFormatNodes[0].appendChild(br);
dom.replace(newBlockElm, blockElm);
rng.setStartBefore(br);
rng.setEndBefore(br);
editor.selection.setRng(rng);
return br;
}
return null;
}
function isTextBlock(node) {
return node && editor.schema.getTextBlockElements()[node.tagName];
}
if (!rng.collapsed) {
return;
}
container = rng.startContainer;
offset = rng.startOffset;
blockElm = dom.getParent(container, dom.isBlock);
if (!isTextBlock(blockElm)) {
return;
}
if (container.nodeType == 1) {
container = container.childNodes[offset];
if (container && container.tagName != 'BR') {
return;
}
if (isForward) {
sibling = blockElm.nextSibling;
} else {
sibling = blockElm.previousSibling;
}
if (dom.isEmpty(blockElm) && isTextBlock(sibling) && dom.isEmpty(sibling)) {
if (cloneTextBlockWithFormats(blockElm, container)) {
dom.remove(sibling);
return true;
}
}
} else if (container.nodeType == 3) {
path = NodePath.create(blockElm, container);
clonedBlockElm = blockElm.cloneNode(true);
container = NodePath.resolve(clonedBlockElm, path);
if (isForward) {
if (offset >= container.data.length) {
return;
}
container.deleteData(offset, 1);
} else {
if (offset <= 0) {
return;
}
container.deleteData(offset - 1, 1);
}
if (dom.isEmpty(clonedBlockElm)) {
return cloneTextBlockWithFormats(blockElm, container);
}
}
} | javascript | function handleLastBlockCharacterDelete(isForward, rng) {
var path, blockElm, newBlockElm, clonedBlockElm, sibling,
container, offset, br, currentFormatNodes;
function cloneTextBlockWithFormats(blockElm, node) {
currentFormatNodes = $(node).parents().filter(function (idx, node) {
return !!editor.schema.getTextInlineElements()[node.nodeName];
});
newBlockElm = blockElm.cloneNode(false);
currentFormatNodes = Tools.map(currentFormatNodes, function (formatNode) {
formatNode = formatNode.cloneNode(false);
if (newBlockElm.hasChildNodes()) {
formatNode.appendChild(newBlockElm.firstChild);
newBlockElm.appendChild(formatNode);
} else {
newBlockElm.appendChild(formatNode);
}
newBlockElm.appendChild(formatNode);
return formatNode;
});
if (currentFormatNodes.length) {
br = dom.create('br');
currentFormatNodes[0].appendChild(br);
dom.replace(newBlockElm, blockElm);
rng.setStartBefore(br);
rng.setEndBefore(br);
editor.selection.setRng(rng);
return br;
}
return null;
}
function isTextBlock(node) {
return node && editor.schema.getTextBlockElements()[node.tagName];
}
if (!rng.collapsed) {
return;
}
container = rng.startContainer;
offset = rng.startOffset;
blockElm = dom.getParent(container, dom.isBlock);
if (!isTextBlock(blockElm)) {
return;
}
if (container.nodeType == 1) {
container = container.childNodes[offset];
if (container && container.tagName != 'BR') {
return;
}
if (isForward) {
sibling = blockElm.nextSibling;
} else {
sibling = blockElm.previousSibling;
}
if (dom.isEmpty(blockElm) && isTextBlock(sibling) && dom.isEmpty(sibling)) {
if (cloneTextBlockWithFormats(blockElm, container)) {
dom.remove(sibling);
return true;
}
}
} else if (container.nodeType == 3) {
path = NodePath.create(blockElm, container);
clonedBlockElm = blockElm.cloneNode(true);
container = NodePath.resolve(clonedBlockElm, path);
if (isForward) {
if (offset >= container.data.length) {
return;
}
container.deleteData(offset, 1);
} else {
if (offset <= 0) {
return;
}
container.deleteData(offset - 1, 1);
}
if (dom.isEmpty(clonedBlockElm)) {
return cloneTextBlockWithFormats(blockElm, container);
}
}
} | [
"function",
"handleLastBlockCharacterDelete",
"(",
"isForward",
",",
"rng",
")",
"{",
"var",
"path",
",",
"blockElm",
",",
"newBlockElm",
",",
"clonedBlockElm",
",",
"sibling",
",",
"container",
",",
"offset",
",",
"br",
",",
"currentFormatNodes",
";",
"function",
"cloneTextBlockWithFormats",
"(",
"blockElm",
",",
"node",
")",
"{",
"currentFormatNodes",
"=",
"$",
"(",
"node",
")",
".",
"parents",
"(",
")",
".",
"filter",
"(",
"function",
"(",
"idx",
",",
"node",
")",
"{",
"return",
"!",
"!",
"editor",
".",
"schema",
".",
"getTextInlineElements",
"(",
")",
"[",
"node",
".",
"nodeName",
"]",
";",
"}",
")",
";",
"newBlockElm",
"=",
"blockElm",
".",
"cloneNode",
"(",
"false",
")",
";",
"currentFormatNodes",
"=",
"Tools",
".",
"map",
"(",
"currentFormatNodes",
",",
"function",
"(",
"formatNode",
")",
"{",
"formatNode",
"=",
"formatNode",
".",
"cloneNode",
"(",
"false",
")",
";",
"if",
"(",
"newBlockElm",
".",
"hasChildNodes",
"(",
")",
")",
"{",
"formatNode",
".",
"appendChild",
"(",
"newBlockElm",
".",
"firstChild",
")",
";",
"newBlockElm",
".",
"appendChild",
"(",
"formatNode",
")",
";",
"}",
"else",
"{",
"newBlockElm",
".",
"appendChild",
"(",
"formatNode",
")",
";",
"}",
"newBlockElm",
".",
"appendChild",
"(",
"formatNode",
")",
";",
"return",
"formatNode",
";",
"}",
")",
";",
"if",
"(",
"currentFormatNodes",
".",
"length",
")",
"{",
"br",
"=",
"dom",
".",
"create",
"(",
"'br'",
")",
";",
"currentFormatNodes",
"[",
"0",
"]",
".",
"appendChild",
"(",
"br",
")",
";",
"dom",
".",
"replace",
"(",
"newBlockElm",
",",
"blockElm",
")",
";",
"rng",
".",
"setStartBefore",
"(",
"br",
")",
";",
"rng",
".",
"setEndBefore",
"(",
"br",
")",
";",
"editor",
".",
"selection",
".",
"setRng",
"(",
"rng",
")",
";",
"return",
"br",
";",
"}",
"return",
"null",
";",
"}",
"function",
"isTextBlock",
"(",
"node",
")",
"{",
"return",
"node",
"&&",
"editor",
".",
"schema",
".",
"getTextBlockElements",
"(",
")",
"[",
"node",
".",
"tagName",
"]",
";",
"}",
"if",
"(",
"!",
"rng",
".",
"collapsed",
")",
"{",
"return",
";",
"}",
"container",
"=",
"rng",
".",
"startContainer",
";",
"offset",
"=",
"rng",
".",
"startOffset",
";",
"blockElm",
"=",
"dom",
".",
"getParent",
"(",
"container",
",",
"dom",
".",
"isBlock",
")",
";",
"if",
"(",
"!",
"isTextBlock",
"(",
"blockElm",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"container",
".",
"nodeType",
"==",
"1",
")",
"{",
"container",
"=",
"container",
".",
"childNodes",
"[",
"offset",
"]",
";",
"if",
"(",
"container",
"&&",
"container",
".",
"tagName",
"!=",
"'BR'",
")",
"{",
"return",
";",
"}",
"if",
"(",
"isForward",
")",
"{",
"sibling",
"=",
"blockElm",
".",
"nextSibling",
";",
"}",
"else",
"{",
"sibling",
"=",
"blockElm",
".",
"previousSibling",
";",
"}",
"if",
"(",
"dom",
".",
"isEmpty",
"(",
"blockElm",
")",
"&&",
"isTextBlock",
"(",
"sibling",
")",
"&&",
"dom",
".",
"isEmpty",
"(",
"sibling",
")",
")",
"{",
"if",
"(",
"cloneTextBlockWithFormats",
"(",
"blockElm",
",",
"container",
")",
")",
"{",
"dom",
".",
"remove",
"(",
"sibling",
")",
";",
"return",
"true",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"container",
".",
"nodeType",
"==",
"3",
")",
"{",
"path",
"=",
"NodePath",
".",
"create",
"(",
"blockElm",
",",
"container",
")",
";",
"clonedBlockElm",
"=",
"blockElm",
".",
"cloneNode",
"(",
"true",
")",
";",
"container",
"=",
"NodePath",
".",
"resolve",
"(",
"clonedBlockElm",
",",
"path",
")",
";",
"if",
"(",
"isForward",
")",
"{",
"if",
"(",
"offset",
">=",
"container",
".",
"data",
".",
"length",
")",
"{",
"return",
";",
"}",
"container",
".",
"deleteData",
"(",
"offset",
",",
"1",
")",
";",
"}",
"else",
"{",
"if",
"(",
"offset",
"<=",
"0",
")",
"{",
"return",
";",
"}",
"container",
".",
"deleteData",
"(",
"offset",
"-",
"1",
",",
"1",
")",
";",
"}",
"if",
"(",
"dom",
".",
"isEmpty",
"(",
"clonedBlockElm",
")",
")",
"{",
"return",
"cloneTextBlockWithFormats",
"(",
"blockElm",
",",
"container",
")",
";",
"}",
"}",
"}"
] | This retains the formatting if the last character is to be deleted.
Backspace on this: <p><b><i>a|</i></b></p> would become <p>|</p> in WebKit.
With this patch: <p><b><i>|<br></i></b></p> | [
"This",
"retains",
"the",
"formatting",
"if",
"the",
"last",
"character",
"is",
"to",
"be",
"deleted",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L33902-L33999 |
48,290 | sadiqhabib/tinymce-dist | tinymce.full.js | emptyEditorWhenDeleting | function emptyEditorWhenDeleting() {
function serializeRng(rng) {
var body = dom.create("body");
var contents = rng.cloneContents();
body.appendChild(contents);
return selection.serializer.serialize(body, { format: 'html' });
}
function allContentsSelected(rng) {
if (!rng.setStart) {
if (rng.item) {
return false;
}
var bodyRng = rng.duplicate();
bodyRng.moveToElementText(editor.getBody());
return RangeUtils.compareRanges(rng, bodyRng);
}
var selection = serializeRng(rng);
var allRng = dom.createRng();
allRng.selectNode(editor.getBody());
var allSelection = serializeRng(allRng);
return selection === allSelection;
}
editor.on('keydown', function (e) {
var keyCode = e.keyCode, isCollapsed, body;
// Empty the editor if it's needed for example backspace at <p><b>|</b></p>
if (!isDefaultPrevented(e) && (keyCode == DELETE || keyCode == BACKSPACE)) {
isCollapsed = editor.selection.isCollapsed();
body = editor.getBody();
// Selection is collapsed but the editor isn't empty
if (isCollapsed && !dom.isEmpty(body)) {
return;
}
// Selection isn't collapsed but not all the contents is selected
if (!isCollapsed && !allContentsSelected(editor.selection.getRng())) {
return;
}
// Manually empty the editor
e.preventDefault();
editor.setContent('');
if (body.firstChild && dom.isBlock(body.firstChild)) {
editor.selection.setCursorLocation(body.firstChild, 0);
} else {
editor.selection.setCursorLocation(body, 0);
}
editor.nodeChanged();
}
});
} | javascript | function emptyEditorWhenDeleting() {
function serializeRng(rng) {
var body = dom.create("body");
var contents = rng.cloneContents();
body.appendChild(contents);
return selection.serializer.serialize(body, { format: 'html' });
}
function allContentsSelected(rng) {
if (!rng.setStart) {
if (rng.item) {
return false;
}
var bodyRng = rng.duplicate();
bodyRng.moveToElementText(editor.getBody());
return RangeUtils.compareRanges(rng, bodyRng);
}
var selection = serializeRng(rng);
var allRng = dom.createRng();
allRng.selectNode(editor.getBody());
var allSelection = serializeRng(allRng);
return selection === allSelection;
}
editor.on('keydown', function (e) {
var keyCode = e.keyCode, isCollapsed, body;
// Empty the editor if it's needed for example backspace at <p><b>|</b></p>
if (!isDefaultPrevented(e) && (keyCode == DELETE || keyCode == BACKSPACE)) {
isCollapsed = editor.selection.isCollapsed();
body = editor.getBody();
// Selection is collapsed but the editor isn't empty
if (isCollapsed && !dom.isEmpty(body)) {
return;
}
// Selection isn't collapsed but not all the contents is selected
if (!isCollapsed && !allContentsSelected(editor.selection.getRng())) {
return;
}
// Manually empty the editor
e.preventDefault();
editor.setContent('');
if (body.firstChild && dom.isBlock(body.firstChild)) {
editor.selection.setCursorLocation(body.firstChild, 0);
} else {
editor.selection.setCursorLocation(body, 0);
}
editor.nodeChanged();
}
});
} | [
"function",
"emptyEditorWhenDeleting",
"(",
")",
"{",
"function",
"serializeRng",
"(",
"rng",
")",
"{",
"var",
"body",
"=",
"dom",
".",
"create",
"(",
"\"body\"",
")",
";",
"var",
"contents",
"=",
"rng",
".",
"cloneContents",
"(",
")",
";",
"body",
".",
"appendChild",
"(",
"contents",
")",
";",
"return",
"selection",
".",
"serializer",
".",
"serialize",
"(",
"body",
",",
"{",
"format",
":",
"'html'",
"}",
")",
";",
"}",
"function",
"allContentsSelected",
"(",
"rng",
")",
"{",
"if",
"(",
"!",
"rng",
".",
"setStart",
")",
"{",
"if",
"(",
"rng",
".",
"item",
")",
"{",
"return",
"false",
";",
"}",
"var",
"bodyRng",
"=",
"rng",
".",
"duplicate",
"(",
")",
";",
"bodyRng",
".",
"moveToElementText",
"(",
"editor",
".",
"getBody",
"(",
")",
")",
";",
"return",
"RangeUtils",
".",
"compareRanges",
"(",
"rng",
",",
"bodyRng",
")",
";",
"}",
"var",
"selection",
"=",
"serializeRng",
"(",
"rng",
")",
";",
"var",
"allRng",
"=",
"dom",
".",
"createRng",
"(",
")",
";",
"allRng",
".",
"selectNode",
"(",
"editor",
".",
"getBody",
"(",
")",
")",
";",
"var",
"allSelection",
"=",
"serializeRng",
"(",
"allRng",
")",
";",
"return",
"selection",
"===",
"allSelection",
";",
"}",
"editor",
".",
"on",
"(",
"'keydown'",
",",
"function",
"(",
"e",
")",
"{",
"var",
"keyCode",
"=",
"e",
".",
"keyCode",
",",
"isCollapsed",
",",
"body",
";",
"// Empty the editor if it's needed for example backspace at <p><b>|</b></p>",
"if",
"(",
"!",
"isDefaultPrevented",
"(",
"e",
")",
"&&",
"(",
"keyCode",
"==",
"DELETE",
"||",
"keyCode",
"==",
"BACKSPACE",
")",
")",
"{",
"isCollapsed",
"=",
"editor",
".",
"selection",
".",
"isCollapsed",
"(",
")",
";",
"body",
"=",
"editor",
".",
"getBody",
"(",
")",
";",
"// Selection is collapsed but the editor isn't empty",
"if",
"(",
"isCollapsed",
"&&",
"!",
"dom",
".",
"isEmpty",
"(",
"body",
")",
")",
"{",
"return",
";",
"}",
"// Selection isn't collapsed but not all the contents is selected",
"if",
"(",
"!",
"isCollapsed",
"&&",
"!",
"allContentsSelected",
"(",
"editor",
".",
"selection",
".",
"getRng",
"(",
")",
")",
")",
"{",
"return",
";",
"}",
"// Manually empty the editor",
"e",
".",
"preventDefault",
"(",
")",
";",
"editor",
".",
"setContent",
"(",
"''",
")",
";",
"if",
"(",
"body",
".",
"firstChild",
"&&",
"dom",
".",
"isBlock",
"(",
"body",
".",
"firstChild",
")",
")",
"{",
"editor",
".",
"selection",
".",
"setCursorLocation",
"(",
"body",
".",
"firstChild",
",",
"0",
")",
";",
"}",
"else",
"{",
"editor",
".",
"selection",
".",
"setCursorLocation",
"(",
"body",
",",
"0",
")",
";",
"}",
"editor",
".",
"nodeChanged",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Makes sure that the editor body becomes empty when backspace or delete is pressed in empty editors.
For example:
<p><b>|</b></p>
Or:
<h1>|</h1>
Or:
[<h1></h1>] | [
"Makes",
"sure",
"that",
"the",
"editor",
"body",
"becomes",
"empty",
"when",
"backspace",
"or",
"delete",
"is",
"pressed",
"in",
"empty",
"editors",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L34250-L34309 |
48,291 | sadiqhabib/tinymce-dist | tinymce.full.js | inputMethodFocus | function inputMethodFocus() {
if (!editor.settings.content_editable) {
// Case 1 IME doesn't initialize if you focus the document
// Disabled since it was interferring with the cE=false logic
// Also coultn't reproduce the issue on Safari 9
/*dom.bind(editor.getDoc(), 'focusin', function() {
selection.setRng(selection.getRng());
});*/
// Case 2 IME doesn't initialize if you click the documentElement it also doesn't properly fire the focusin event
// Needs to be both down/up due to weird rendering bug on Chrome Windows
dom.bind(editor.getDoc(), 'mousedown mouseup', function (e) {
var rng;
if (e.target == editor.getDoc().documentElement) {
rng = selection.getRng();
editor.getBody().focus();
if (e.type == 'mousedown') {
if (CaretContainer.isCaretContainer(rng.startContainer)) {
return;
}
// Edge case for mousedown, drag select and mousedown again within selection on Chrome Windows to render caret
selection.placeCaretAt(e.clientX, e.clientY);
} else {
selection.setRng(rng);
}
}
});
}
} | javascript | function inputMethodFocus() {
if (!editor.settings.content_editable) {
// Case 1 IME doesn't initialize if you focus the document
// Disabled since it was interferring with the cE=false logic
// Also coultn't reproduce the issue on Safari 9
/*dom.bind(editor.getDoc(), 'focusin', function() {
selection.setRng(selection.getRng());
});*/
// Case 2 IME doesn't initialize if you click the documentElement it also doesn't properly fire the focusin event
// Needs to be both down/up due to weird rendering bug on Chrome Windows
dom.bind(editor.getDoc(), 'mousedown mouseup', function (e) {
var rng;
if (e.target == editor.getDoc().documentElement) {
rng = selection.getRng();
editor.getBody().focus();
if (e.type == 'mousedown') {
if (CaretContainer.isCaretContainer(rng.startContainer)) {
return;
}
// Edge case for mousedown, drag select and mousedown again within selection on Chrome Windows to render caret
selection.placeCaretAt(e.clientX, e.clientY);
} else {
selection.setRng(rng);
}
}
});
}
} | [
"function",
"inputMethodFocus",
"(",
")",
"{",
"if",
"(",
"!",
"editor",
".",
"settings",
".",
"content_editable",
")",
"{",
"// Case 1 IME doesn't initialize if you focus the document",
"// Disabled since it was interferring with the cE=false logic",
"// Also coultn't reproduce the issue on Safari 9",
"/*dom.bind(editor.getDoc(), 'focusin', function() {\n selection.setRng(selection.getRng());\n });*/",
"// Case 2 IME doesn't initialize if you click the documentElement it also doesn't properly fire the focusin event",
"// Needs to be both down/up due to weird rendering bug on Chrome Windows",
"dom",
".",
"bind",
"(",
"editor",
".",
"getDoc",
"(",
")",
",",
"'mousedown mouseup'",
",",
"function",
"(",
"e",
")",
"{",
"var",
"rng",
";",
"if",
"(",
"e",
".",
"target",
"==",
"editor",
".",
"getDoc",
"(",
")",
".",
"documentElement",
")",
"{",
"rng",
"=",
"selection",
".",
"getRng",
"(",
")",
";",
"editor",
".",
"getBody",
"(",
")",
".",
"focus",
"(",
")",
";",
"if",
"(",
"e",
".",
"type",
"==",
"'mousedown'",
")",
"{",
"if",
"(",
"CaretContainer",
".",
"isCaretContainer",
"(",
"rng",
".",
"startContainer",
")",
")",
"{",
"return",
";",
"}",
"// Edge case for mousedown, drag select and mousedown again within selection on Chrome Windows to render caret",
"selection",
".",
"placeCaretAt",
"(",
"e",
".",
"clientX",
",",
"e",
".",
"clientY",
")",
";",
"}",
"else",
"{",
"selection",
".",
"setRng",
"(",
"rng",
")",
";",
"}",
"}",
"}",
")",
";",
"}",
"}"
] | WebKit has a weird issue where it some times fails to properly convert keypresses to input method keystrokes.
The IME on Mac doesn't initialize when it doesn't fire a proper focus event.
This seems to happen when the user manages to click the documentElement element then the window doesn't get proper focus until
you enter a character into the editor.
It also happens when the first focus in made to the body.
See: https://bugs.webkit.org/show_bug.cgi?id=83566 | [
"WebKit",
"has",
"a",
"weird",
"issue",
"where",
"it",
"some",
"times",
"fails",
"to",
"properly",
"convert",
"keypresses",
"to",
"input",
"method",
"keystrokes",
".",
"The",
"IME",
"on",
"Mac",
"doesn",
"t",
"initialize",
"when",
"it",
"doesn",
"t",
"fire",
"a",
"proper",
"focus",
"event",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L34331-L34362 |
48,292 | sadiqhabib/tinymce-dist | tinymce.full.js | focusBody | function focusBody() {
// Fix for a focus bug in FF 3.x where the body element
// wouldn't get proper focus if the user clicked on the HTML element
if (!window.Range.prototype.getClientRects) { // Detect getClientRects got introduced in FF 4
editor.on('mousedown', function (e) {
if (!isDefaultPrevented(e) && e.target.nodeName === "HTML") {
var body = editor.getBody();
// Blur the body it's focused but not correctly focused
body.blur();
// Refocus the body after a little while
Delay.setEditorTimeout(editor, function () {
body.focus();
});
}
});
}
} | javascript | function focusBody() {
// Fix for a focus bug in FF 3.x where the body element
// wouldn't get proper focus if the user clicked on the HTML element
if (!window.Range.prototype.getClientRects) { // Detect getClientRects got introduced in FF 4
editor.on('mousedown', function (e) {
if (!isDefaultPrevented(e) && e.target.nodeName === "HTML") {
var body = editor.getBody();
// Blur the body it's focused but not correctly focused
body.blur();
// Refocus the body after a little while
Delay.setEditorTimeout(editor, function () {
body.focus();
});
}
});
}
} | [
"function",
"focusBody",
"(",
")",
"{",
"// Fix for a focus bug in FF 3.x where the body element",
"// wouldn't get proper focus if the user clicked on the HTML element",
"if",
"(",
"!",
"window",
".",
"Range",
".",
"prototype",
".",
"getClientRects",
")",
"{",
"// Detect getClientRects got introduced in FF 4",
"editor",
".",
"on",
"(",
"'mousedown'",
",",
"function",
"(",
"e",
")",
"{",
"if",
"(",
"!",
"isDefaultPrevented",
"(",
"e",
")",
"&&",
"e",
".",
"target",
".",
"nodeName",
"===",
"\"HTML\"",
")",
"{",
"var",
"body",
"=",
"editor",
".",
"getBody",
"(",
")",
";",
"// Blur the body it's focused but not correctly focused",
"body",
".",
"blur",
"(",
")",
";",
"// Refocus the body after a little while",
"Delay",
".",
"setEditorTimeout",
"(",
"editor",
",",
"function",
"(",
")",
"{",
"body",
".",
"focus",
"(",
")",
";",
"}",
")",
";",
"}",
"}",
")",
";",
"}",
"}"
] | Firefox 3.x has an issue where the body element won't get proper focus if you click out
side it's rectangle. | [
"Firefox",
"3",
".",
"x",
"has",
"an",
"issue",
"where",
"the",
"body",
"element",
"won",
"t",
"get",
"proper",
"focus",
"if",
"you",
"click",
"out",
"side",
"it",
"s",
"rectangle",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L34404-L34422 |
48,293 | sadiqhabib/tinymce-dist | tinymce.full.js | selectControlElements | function selectControlElements() {
editor.on('click', function (e) {
var target = e.target;
// Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250
// WebKit can't even do simple things like selecting an image
// Needs to be the setBaseAndExtend or it will fail to select floated images
if (/^(IMG|HR)$/.test(target.nodeName) && dom.getContentEditableParent(target) !== "false") {
e.preventDefault();
editor.selection.select(target);
editor.nodeChanged();
}
if (target.nodeName == 'A' && dom.hasClass(target, 'mce-item-anchor')) {
e.preventDefault();
selection.select(target);
}
});
} | javascript | function selectControlElements() {
editor.on('click', function (e) {
var target = e.target;
// Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250
// WebKit can't even do simple things like selecting an image
// Needs to be the setBaseAndExtend or it will fail to select floated images
if (/^(IMG|HR)$/.test(target.nodeName) && dom.getContentEditableParent(target) !== "false") {
e.preventDefault();
editor.selection.select(target);
editor.nodeChanged();
}
if (target.nodeName == 'A' && dom.hasClass(target, 'mce-item-anchor')) {
e.preventDefault();
selection.select(target);
}
});
} | [
"function",
"selectControlElements",
"(",
")",
"{",
"editor",
".",
"on",
"(",
"'click'",
",",
"function",
"(",
"e",
")",
"{",
"var",
"target",
"=",
"e",
".",
"target",
";",
"// Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250",
"// WebKit can't even do simple things like selecting an image",
"// Needs to be the setBaseAndExtend or it will fail to select floated images",
"if",
"(",
"/",
"^(IMG|HR)$",
"/",
".",
"test",
"(",
"target",
".",
"nodeName",
")",
"&&",
"dom",
".",
"getContentEditableParent",
"(",
"target",
")",
"!==",
"\"false\"",
")",
"{",
"e",
".",
"preventDefault",
"(",
")",
";",
"editor",
".",
"selection",
".",
"select",
"(",
"target",
")",
";",
"editor",
".",
"nodeChanged",
"(",
")",
";",
"}",
"if",
"(",
"target",
".",
"nodeName",
"==",
"'A'",
"&&",
"dom",
".",
"hasClass",
"(",
"target",
",",
"'mce-item-anchor'",
")",
")",
"{",
"e",
".",
"preventDefault",
"(",
")",
";",
"selection",
".",
"select",
"(",
"target",
")",
";",
"}",
"}",
")",
";",
"}"
] | WebKit has a bug where it isn't possible to select image, hr or anchor elements
by clicking on them so we need to fake that. | [
"WebKit",
"has",
"a",
"bug",
"where",
"it",
"isn",
"t",
"possible",
"to",
"select",
"image",
"hr",
"or",
"anchor",
"elements",
"by",
"clicking",
"on",
"them",
"so",
"we",
"need",
"to",
"fake",
"that",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L34428-L34446 |
48,294 | sadiqhabib/tinymce-dist | tinymce.full.js | removeStylesWhenDeletingAcrossBlockElements | function removeStylesWhenDeletingAcrossBlockElements() {
function getAttributeApplyFunction() {
var template = dom.getAttribs(selection.getStart().cloneNode(false));
return function () {
var target = selection.getStart();
if (target !== editor.getBody()) {
dom.setAttrib(target, "style", null);
each(template, function (attr) {
target.setAttributeNode(attr.cloneNode(true));
});
}
};
}
function isSelectionAcrossElements() {
return !selection.isCollapsed() &&
dom.getParent(selection.getStart(), dom.isBlock) != dom.getParent(selection.getEnd(), dom.isBlock);
}
editor.on('keypress', function (e) {
var applyAttributes;
if (!isDefaultPrevented(e) && (e.keyCode == 8 || e.keyCode == 46) && isSelectionAcrossElements()) {
applyAttributes = getAttributeApplyFunction();
editor.getDoc().execCommand('delete', false, null);
applyAttributes();
e.preventDefault();
return false;
}
});
dom.bind(editor.getDoc(), 'cut', function (e) {
var applyAttributes;
if (!isDefaultPrevented(e) && isSelectionAcrossElements()) {
applyAttributes = getAttributeApplyFunction();
Delay.setEditorTimeout(editor, function () {
applyAttributes();
});
}
});
} | javascript | function removeStylesWhenDeletingAcrossBlockElements() {
function getAttributeApplyFunction() {
var template = dom.getAttribs(selection.getStart().cloneNode(false));
return function () {
var target = selection.getStart();
if (target !== editor.getBody()) {
dom.setAttrib(target, "style", null);
each(template, function (attr) {
target.setAttributeNode(attr.cloneNode(true));
});
}
};
}
function isSelectionAcrossElements() {
return !selection.isCollapsed() &&
dom.getParent(selection.getStart(), dom.isBlock) != dom.getParent(selection.getEnd(), dom.isBlock);
}
editor.on('keypress', function (e) {
var applyAttributes;
if (!isDefaultPrevented(e) && (e.keyCode == 8 || e.keyCode == 46) && isSelectionAcrossElements()) {
applyAttributes = getAttributeApplyFunction();
editor.getDoc().execCommand('delete', false, null);
applyAttributes();
e.preventDefault();
return false;
}
});
dom.bind(editor.getDoc(), 'cut', function (e) {
var applyAttributes;
if (!isDefaultPrevented(e) && isSelectionAcrossElements()) {
applyAttributes = getAttributeApplyFunction();
Delay.setEditorTimeout(editor, function () {
applyAttributes();
});
}
});
} | [
"function",
"removeStylesWhenDeletingAcrossBlockElements",
"(",
")",
"{",
"function",
"getAttributeApplyFunction",
"(",
")",
"{",
"var",
"template",
"=",
"dom",
".",
"getAttribs",
"(",
"selection",
".",
"getStart",
"(",
")",
".",
"cloneNode",
"(",
"false",
")",
")",
";",
"return",
"function",
"(",
")",
"{",
"var",
"target",
"=",
"selection",
".",
"getStart",
"(",
")",
";",
"if",
"(",
"target",
"!==",
"editor",
".",
"getBody",
"(",
")",
")",
"{",
"dom",
".",
"setAttrib",
"(",
"target",
",",
"\"style\"",
",",
"null",
")",
";",
"each",
"(",
"template",
",",
"function",
"(",
"attr",
")",
"{",
"target",
".",
"setAttributeNode",
"(",
"attr",
".",
"cloneNode",
"(",
"true",
")",
")",
";",
"}",
")",
";",
"}",
"}",
";",
"}",
"function",
"isSelectionAcrossElements",
"(",
")",
"{",
"return",
"!",
"selection",
".",
"isCollapsed",
"(",
")",
"&&",
"dom",
".",
"getParent",
"(",
"selection",
".",
"getStart",
"(",
")",
",",
"dom",
".",
"isBlock",
")",
"!=",
"dom",
".",
"getParent",
"(",
"selection",
".",
"getEnd",
"(",
")",
",",
"dom",
".",
"isBlock",
")",
";",
"}",
"editor",
".",
"on",
"(",
"'keypress'",
",",
"function",
"(",
"e",
")",
"{",
"var",
"applyAttributes",
";",
"if",
"(",
"!",
"isDefaultPrevented",
"(",
"e",
")",
"&&",
"(",
"e",
".",
"keyCode",
"==",
"8",
"||",
"e",
".",
"keyCode",
"==",
"46",
")",
"&&",
"isSelectionAcrossElements",
"(",
")",
")",
"{",
"applyAttributes",
"=",
"getAttributeApplyFunction",
"(",
")",
";",
"editor",
".",
"getDoc",
"(",
")",
".",
"execCommand",
"(",
"'delete'",
",",
"false",
",",
"null",
")",
";",
"applyAttributes",
"(",
")",
";",
"e",
".",
"preventDefault",
"(",
")",
";",
"return",
"false",
";",
"}",
"}",
")",
";",
"dom",
".",
"bind",
"(",
"editor",
".",
"getDoc",
"(",
")",
",",
"'cut'",
",",
"function",
"(",
"e",
")",
"{",
"var",
"applyAttributes",
";",
"if",
"(",
"!",
"isDefaultPrevented",
"(",
"e",
")",
"&&",
"isSelectionAcrossElements",
"(",
")",
")",
"{",
"applyAttributes",
"=",
"getAttributeApplyFunction",
"(",
")",
";",
"Delay",
".",
"setEditorTimeout",
"(",
"editor",
",",
"function",
"(",
")",
"{",
"applyAttributes",
"(",
")",
";",
"}",
")",
";",
"}",
"}",
")",
";",
"}"
] | Fixes a Gecko bug where the style attribute gets added to the wrong element when deleting between two block elements.
Fixes do backspace/delete on this:
<p>bla[ck</p><p style="color:red">r]ed</p>
Would become:
<p>bla|ed</p>
Instead of:
<p style="color:red">bla|ed</p> | [
"Fixes",
"a",
"Gecko",
"bug",
"where",
"the",
"style",
"attribute",
"gets",
"added",
"to",
"the",
"wrong",
"element",
"when",
"deleting",
"between",
"two",
"block",
"elements",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L34460-L34505 |
48,295 | sadiqhabib/tinymce-dist | tinymce.full.js | disableBackspaceIntoATable | function disableBackspaceIntoATable() {
editor.on('keydown', function (e) {
if (!isDefaultPrevented(e) && e.keyCode === BACKSPACE) {
if (selection.isCollapsed() && selection.getRng(true).startOffset === 0) {
var previousSibling = selection.getNode().previousSibling;
if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === "table") {
e.preventDefault();
return false;
}
}
}
});
} | javascript | function disableBackspaceIntoATable() {
editor.on('keydown', function (e) {
if (!isDefaultPrevented(e) && e.keyCode === BACKSPACE) {
if (selection.isCollapsed() && selection.getRng(true).startOffset === 0) {
var previousSibling = selection.getNode().previousSibling;
if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === "table") {
e.preventDefault();
return false;
}
}
}
});
} | [
"function",
"disableBackspaceIntoATable",
"(",
")",
"{",
"editor",
".",
"on",
"(",
"'keydown'",
",",
"function",
"(",
"e",
")",
"{",
"if",
"(",
"!",
"isDefaultPrevented",
"(",
"e",
")",
"&&",
"e",
".",
"keyCode",
"===",
"BACKSPACE",
")",
"{",
"if",
"(",
"selection",
".",
"isCollapsed",
"(",
")",
"&&",
"selection",
".",
"getRng",
"(",
"true",
")",
".",
"startOffset",
"===",
"0",
")",
"{",
"var",
"previousSibling",
"=",
"selection",
".",
"getNode",
"(",
")",
".",
"previousSibling",
";",
"if",
"(",
"previousSibling",
"&&",
"previousSibling",
".",
"nodeName",
"&&",
"previousSibling",
".",
"nodeName",
".",
"toLowerCase",
"(",
")",
"===",
"\"table\"",
")",
"{",
"e",
".",
"preventDefault",
"(",
")",
";",
"return",
"false",
";",
"}",
"}",
"}",
"}",
")",
";",
"}"
] | Backspacing into a table behaves differently depending upon browser type.
Therefore, disable Backspace when cursor immediately follows a table. | [
"Backspacing",
"into",
"a",
"table",
"behaves",
"differently",
"depending",
"upon",
"browser",
"type",
".",
"Therefore",
"disable",
"Backspace",
"when",
"cursor",
"immediately",
"follows",
"a",
"table",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L34518-L34530 |
48,296 | sadiqhabib/tinymce-dist | tinymce.full.js | setGeckoEditingOptions | function setGeckoEditingOptions() {
function setOpts() {
refreshContentEditable();
setEditorCommandState("StyleWithCSS", false);
setEditorCommandState("enableInlineTableEditing", false);
if (!settings.object_resizing) {
setEditorCommandState("enableObjectResizing", false);
}
}
if (!settings.readonly) {
editor.on('BeforeExecCommand MouseDown', setOpts);
}
} | javascript | function setGeckoEditingOptions() {
function setOpts() {
refreshContentEditable();
setEditorCommandState("StyleWithCSS", false);
setEditorCommandState("enableInlineTableEditing", false);
if (!settings.object_resizing) {
setEditorCommandState("enableObjectResizing", false);
}
}
if (!settings.readonly) {
editor.on('BeforeExecCommand MouseDown', setOpts);
}
} | [
"function",
"setGeckoEditingOptions",
"(",
")",
"{",
"function",
"setOpts",
"(",
")",
"{",
"refreshContentEditable",
"(",
")",
";",
"setEditorCommandState",
"(",
"\"StyleWithCSS\"",
",",
"false",
")",
";",
"setEditorCommandState",
"(",
"\"enableInlineTableEditing\"",
",",
"false",
")",
";",
"if",
"(",
"!",
"settings",
".",
"object_resizing",
")",
"{",
"setEditorCommandState",
"(",
"\"enableObjectResizing\"",
",",
"false",
")",
";",
"}",
"}",
"if",
"(",
"!",
"settings",
".",
"readonly",
")",
"{",
"editor",
".",
"on",
"(",
"'BeforeExecCommand MouseDown'",
",",
"setOpts",
")",
";",
"}",
"}"
] | Sets various Gecko editing options on mouse down and before a execCommand to disable inline table editing that is broken etc. | [
"Sets",
"various",
"Gecko",
"editing",
"options",
"on",
"mouse",
"down",
"and",
"before",
"a",
"execCommand",
"to",
"disable",
"inline",
"table",
"editing",
"that",
"is",
"broken",
"etc",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L34660-L34675 |
48,297 | sadiqhabib/tinymce-dist | tinymce.full.js | addBrAfterLastLinks | function addBrAfterLastLinks() {
function fixLinks() {
each(dom.select('a'), function (node) {
var parentNode = node.parentNode, root = dom.getRoot();
if (parentNode.lastChild === node) {
while (parentNode && !dom.isBlock(parentNode)) {
if (parentNode.parentNode.lastChild !== parentNode || parentNode === root) {
return;
}
parentNode = parentNode.parentNode;
}
dom.add(parentNode, 'br', { 'data-mce-bogus': 1 });
}
});
}
editor.on('SetContent ExecCommand', function (e) {
if (e.type == "setcontent" || e.command === 'mceInsertLink') {
fixLinks();
}
});
} | javascript | function addBrAfterLastLinks() {
function fixLinks() {
each(dom.select('a'), function (node) {
var parentNode = node.parentNode, root = dom.getRoot();
if (parentNode.lastChild === node) {
while (parentNode && !dom.isBlock(parentNode)) {
if (parentNode.parentNode.lastChild !== parentNode || parentNode === root) {
return;
}
parentNode = parentNode.parentNode;
}
dom.add(parentNode, 'br', { 'data-mce-bogus': 1 });
}
});
}
editor.on('SetContent ExecCommand', function (e) {
if (e.type == "setcontent" || e.command === 'mceInsertLink') {
fixLinks();
}
});
} | [
"function",
"addBrAfterLastLinks",
"(",
")",
"{",
"function",
"fixLinks",
"(",
")",
"{",
"each",
"(",
"dom",
".",
"select",
"(",
"'a'",
")",
",",
"function",
"(",
"node",
")",
"{",
"var",
"parentNode",
"=",
"node",
".",
"parentNode",
",",
"root",
"=",
"dom",
".",
"getRoot",
"(",
")",
";",
"if",
"(",
"parentNode",
".",
"lastChild",
"===",
"node",
")",
"{",
"while",
"(",
"parentNode",
"&&",
"!",
"dom",
".",
"isBlock",
"(",
"parentNode",
")",
")",
"{",
"if",
"(",
"parentNode",
".",
"parentNode",
".",
"lastChild",
"!==",
"parentNode",
"||",
"parentNode",
"===",
"root",
")",
"{",
"return",
";",
"}",
"parentNode",
"=",
"parentNode",
".",
"parentNode",
";",
"}",
"dom",
".",
"add",
"(",
"parentNode",
",",
"'br'",
",",
"{",
"'data-mce-bogus'",
":",
"1",
"}",
")",
";",
"}",
"}",
")",
";",
"}",
"editor",
".",
"on",
"(",
"'SetContent ExecCommand'",
",",
"function",
"(",
"e",
")",
"{",
"if",
"(",
"e",
".",
"type",
"==",
"\"setcontent\"",
"||",
"e",
".",
"command",
"===",
"'mceInsertLink'",
")",
"{",
"fixLinks",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Fixes a gecko link bug, when a link is placed at the end of block elements there is
no way to move the caret behind the link. This fix adds a bogus br element after the link.
For example this:
<p><b><a href="#">x</a></b></p>
Becomes this:
<p><b><a href="#">x</a></b><br></p> | [
"Fixes",
"a",
"gecko",
"link",
"bug",
"when",
"a",
"link",
"is",
"placed",
"at",
"the",
"end",
"of",
"block",
"elements",
"there",
"is",
"no",
"way",
"to",
"move",
"the",
"caret",
"behind",
"the",
"link",
".",
"This",
"fix",
"adds",
"a",
"bogus",
"br",
"element",
"after",
"the",
"link",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L34687-L34711 |
48,298 | sadiqhabib/tinymce-dist | tinymce.full.js | keepNoScriptContents | function keepNoScriptContents() {
if (getDocumentMode() < 9) {
parser.addNodeFilter('noscript', function (nodes) {
var i = nodes.length, node, textNode;
while (i--) {
node = nodes[i];
textNode = node.firstChild;
if (textNode) {
node.attr('data-mce-innertext', textNode.value);
}
}
});
serializer.addNodeFilter('noscript', function (nodes) {
var i = nodes.length, node, textNode, value;
while (i--) {
node = nodes[i];
textNode = nodes[i].firstChild;
if (textNode) {
textNode.value = Entities.decode(textNode.value);
} else {
// Old IE can't retain noscript value so an attribute is used to store it
value = node.attributes.map['data-mce-innertext'];
if (value) {
node.attr('data-mce-innertext', null);
textNode = new Node('#text', 3);
textNode.value = value;
textNode.raw = true;
node.append(textNode);
}
}
}
});
}
} | javascript | function keepNoScriptContents() {
if (getDocumentMode() < 9) {
parser.addNodeFilter('noscript', function (nodes) {
var i = nodes.length, node, textNode;
while (i--) {
node = nodes[i];
textNode = node.firstChild;
if (textNode) {
node.attr('data-mce-innertext', textNode.value);
}
}
});
serializer.addNodeFilter('noscript', function (nodes) {
var i = nodes.length, node, textNode, value;
while (i--) {
node = nodes[i];
textNode = nodes[i].firstChild;
if (textNode) {
textNode.value = Entities.decode(textNode.value);
} else {
// Old IE can't retain noscript value so an attribute is used to store it
value = node.attributes.map['data-mce-innertext'];
if (value) {
node.attr('data-mce-innertext', null);
textNode = new Node('#text', 3);
textNode.value = value;
textNode.raw = true;
node.append(textNode);
}
}
}
});
}
} | [
"function",
"keepNoScriptContents",
"(",
")",
"{",
"if",
"(",
"getDocumentMode",
"(",
")",
"<",
"9",
")",
"{",
"parser",
".",
"addNodeFilter",
"(",
"'noscript'",
",",
"function",
"(",
"nodes",
")",
"{",
"var",
"i",
"=",
"nodes",
".",
"length",
",",
"node",
",",
"textNode",
";",
"while",
"(",
"i",
"--",
")",
"{",
"node",
"=",
"nodes",
"[",
"i",
"]",
";",
"textNode",
"=",
"node",
".",
"firstChild",
";",
"if",
"(",
"textNode",
")",
"{",
"node",
".",
"attr",
"(",
"'data-mce-innertext'",
",",
"textNode",
".",
"value",
")",
";",
"}",
"}",
"}",
")",
";",
"serializer",
".",
"addNodeFilter",
"(",
"'noscript'",
",",
"function",
"(",
"nodes",
")",
"{",
"var",
"i",
"=",
"nodes",
".",
"length",
",",
"node",
",",
"textNode",
",",
"value",
";",
"while",
"(",
"i",
"--",
")",
"{",
"node",
"=",
"nodes",
"[",
"i",
"]",
";",
"textNode",
"=",
"nodes",
"[",
"i",
"]",
".",
"firstChild",
";",
"if",
"(",
"textNode",
")",
"{",
"textNode",
".",
"value",
"=",
"Entities",
".",
"decode",
"(",
"textNode",
".",
"value",
")",
";",
"}",
"else",
"{",
"// Old IE can't retain noscript value so an attribute is used to store it",
"value",
"=",
"node",
".",
"attributes",
".",
"map",
"[",
"'data-mce-innertext'",
"]",
";",
"if",
"(",
"value",
")",
"{",
"node",
".",
"attr",
"(",
"'data-mce-innertext'",
",",
"null",
")",
";",
"textNode",
"=",
"new",
"Node",
"(",
"'#text'",
",",
"3",
")",
";",
"textNode",
".",
"value",
"=",
"value",
";",
"textNode",
".",
"raw",
"=",
"true",
";",
"node",
".",
"append",
"(",
"textNode",
")",
";",
"}",
"}",
"}",
"}",
")",
";",
"}",
"}"
] | Old IE versions can't retain contents within noscript elements so this logic will store the contents
as a attribute and the insert that value as it's raw text when the DOM is serialized. | [
"Old",
"IE",
"versions",
"can",
"t",
"retain",
"contents",
"within",
"noscript",
"elements",
"so",
"this",
"logic",
"will",
"store",
"the",
"contents",
"as",
"a",
"attribute",
"and",
"the",
"insert",
"that",
"value",
"as",
"it",
"s",
"raw",
"text",
"when",
"the",
"DOM",
"is",
"serialized",
"."
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L34767-L34805 |
48,299 | sadiqhabib/tinymce-dist | tinymce.full.js | rngFromPoint | function rngFromPoint(x, y) {
var rng = body.createTextRange();
try {
rng.moveToPoint(x, y);
} catch (ex) {
// IE sometimes throws and exception, so lets just ignore it
rng = null;
}
return rng;
} | javascript | function rngFromPoint(x, y) {
var rng = body.createTextRange();
try {
rng.moveToPoint(x, y);
} catch (ex) {
// IE sometimes throws and exception, so lets just ignore it
rng = null;
}
return rng;
} | [
"function",
"rngFromPoint",
"(",
"x",
",",
"y",
")",
"{",
"var",
"rng",
"=",
"body",
".",
"createTextRange",
"(",
")",
";",
"try",
"{",
"rng",
".",
"moveToPoint",
"(",
"x",
",",
"y",
")",
";",
"}",
"catch",
"(",
"ex",
")",
"{",
"// IE sometimes throws and exception, so lets just ignore it",
"rng",
"=",
"null",
";",
"}",
"return",
"rng",
";",
"}"
] | Return range from point or null if it failed | [
"Return",
"range",
"from",
"point",
"or",
"null",
"if",
"it",
"failed"
] | 3acf1e4fe83a541988fdca20f2aaf4e6dce72512 | https://github.com/sadiqhabib/tinymce-dist/blob/3acf1e4fe83a541988fdca20f2aaf4e6dce72512/tinymce.full.js#L34814-L34825 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.