_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q35900
train
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...
javascript
{ "resource": "" }
q35901
train
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 f...
javascript
{ "resource": "" }
q35902
train
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) ...
javascript
{ "resource": "" }
q35903
train
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 ...
javascript
{ "resource": "" }
q35904
train
function (items) { var self = this; self.items().set(self.create(items).concat(self.items().toArray())); return self.renderNew(); }
javascript
{ "resource": "" }
q35905
train
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) { befor...
javascript
{ "resource": "" }
q35906
train
function (data) { var self = this; for (var name in data) { self.find('#' + name).value(data[name]); } return self; }
javascript
{ "resource": "" }
q35907
train
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
{ "resource": "" }
q35908
train
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].repai...
javascript
{ "resource": "" }
q35909
train
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
{ "resource": "" }
q35910
train
function (dx, dy) { var self = this, rect = self.layoutRect(); self.moveTo(rect.x + dx, rect.y + dy); return self; }
javascript
{ "resource": "" }
q35911
train
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; ...
javascript
{ "resource": "" }
q35912
repositionPanel
train
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(); wh...
javascript
{ "resource": "" }
q35913
train
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
{ "resource": "" }
q35914
train
function () { var self = this; if (!self.fire('close').isDefaultPrevented()) { self.remove(); addRemove(false, self); } return self; }
javascript
{ "resource": "" }
q35915
train
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 layo...
javascript
{ "resource": "" }
q35916
train
function (settings) { var buttons, callback = settings.callback || function () { }; function createButton(text, status, primary) { return { type: "button", text: text, subtype: primary ? 'primary' : '', onClick: function (e) { ...
javascript
{ "resource": "" }
q35917
train
function (settings, callback) { if (typeof settings == "string") { settings = { text: settings }; } settings.callback = callback; return MessageBox.msgBox(settings); }
javascript
{ "resource": "" }
q35918
train
function (settings, callback) { if (typeof settings == "string") { settings = { text: settings }; } settings.callback = callback; settings.buttons = MessageBox.OK_CANCEL; return MessageBox.msgBox(settings); }
javascript
{ "resource": "" }
q35919
findDuplicateMessage
train
function findDuplicateMessage(notificationArray, newNotification) { if (!isPlainTextNotification(newNotification)) { return null; } var filteredNotifications = Tools.grep(notificationArray, function (notification) { return isSameNotification(newNotification, notification); ...
javascript
{ "resource": "" }
q35920
isSameNotification
train
function isSameNotification(a, b) { return a.type === b.settings.type && a.text === b.settings.text; }
javascript
{ "resource": "" }
q35921
getEventTarget
train
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...
javascript
{ "resource": "" }
q35922
bindEventDelegate
train
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[eventN...
javascript
{ "resource": "" }
q35923
train
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 =...
javascript
{ "resource": "" }
q35924
createNewBlock
train
function createNewBlock(name) { var node = container, block, clonedNode, caretNode, textInlineElements = schema.getTextInlineElements(); if (name || parentBlockName == "TABLE") { block = dom.create(name || newBlockName); setForcedBlockAttrs(block); } else { ...
javascript
{ "resource": "" }
q35925
wrapSelfAndSiblingsInDefaultBlock
train
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 (!par...
javascript
{ "resource": "" }
q35926
trimLeadingLineBreaks
train
function trimLeadingLineBreaks(node) { do { if (node.nodeType === 3) { node.nodeValue = node.nodeValue.replace(/^[\r\n]+/, ''); } node = node.firstChild; } while (node); }
javascript
{ "resource": "" }
q35927
addBrToBlockIfNeeded
train
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 float...
javascript
{ "resource": "" }
q35928
insertClipboardContents
train
function insertClipboardContents(content, internal) { if (editor.queryCommandSupported('mceInsertClipboardContent')) { editor.execCommand('mceInsertClipboardContent', false, { content: content, internal: internal }); } else { editor.execCommand('mceInsertContent', false, content); ...
javascript
{ "resource": "" }
q35929
handleLastBlockCharacterDelete
train
function handleLastBlockCharacterDelete(isForward, rng) { var path, blockElm, newBlockElm, clonedBlockElm, sibling, container, offset, br, currentFormatNodes; function cloneTextBlockWithFormats(blockElm, node) { currentFormatNodes = $(node).parents().filter(function (idx, no...
javascript
{ "resource": "" }
q35930
emptyEditorWhenDeleting
train
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 allContentsSelecte...
javascript
{ "resource": "" }
q35931
inputMethodFocus
train
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(), 'fo...
javascript
{ "resource": "" }
q35932
focusBody
train
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) { ...
javascript
{ "resource": "" }
q35933
selectControlElements
train
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 fa...
javascript
{ "resource": "" }
q35934
removeStylesWhenDeletingAcrossBlockElements
train
function removeStylesWhenDeletingAcrossBlockElements() { function getAttributeApplyFunction() { var template = dom.getAttribs(selection.getStart().cloneNode(false)); return function () { var target = selection.getStart(); if (target !== editor.getBody()) { ...
javascript
{ "resource": "" }
q35935
disableBackspaceIntoATable
train
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; ...
javascript
{ "resource": "" }
q35936
setGeckoEditingOptions
train
function setGeckoEditingOptions() { function setOpts() { refreshContentEditable(); setEditorCommandState("StyleWithCSS", false); setEditorCommandState("enableInlineTableEditing", false); if (!settings.object_resizing) { setEditorCommandState("enableObjectRes...
javascript
{ "resource": "" }
q35937
addBrAfterLastLinks
train
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 (parent...
javascript
{ "resource": "" }
q35938
keepNoScriptContents
train
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) { ...
javascript
{ "resource": "" }
q35939
rngFromPoint
train
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
{ "resource": "" }
q35940
selectionChange
train
function selectionChange(e) { var pointRng; // Check if the button is down or not if (e.button) { // Create range from mouse position pointRng = rngFromPoint(e.x, e.y); if (pointRng) { // Check if pointRange is before/after selection then...
javascript
{ "resource": "" }
q35941
restoreFocusOnKeyDown
train
function restoreFocusOnKeyDown() { if (!editor.inline) { editor.on('keydown', function () { if (document.activeElement == document.body) { editor.getWin().focus(); } }); } }
javascript
{ "resource": "" }
q35942
blockCmdArrowNavigation
train
function blockCmdArrowNavigation() { if (Env.mac) { editor.on('keydown', function (e) { if (VK.metaKeyPressed(e) && !e.shiftKey && (e.keyCode == 37 || e.keyCode == 39)) { e.preventDefault(); editor.selection.getSel().modify('move', e.keyCode == 37 ? 'backward' :...
javascript
{ "resource": "" }
q35943
replaceString
train
function replaceString(content, search, replace) { var index = 0; do { index = content.indexOf(search, index); if (index !== -1) { content = content.substring(0, index) + replace + content.substr(index + search.length); index += replace.length - search.lengt...
javascript
{ "resource": "" }
q35944
train
function (selection) { var rng = selection.getSel().getRangeAt(0); var startContainer = rng.startContainer; return startContainer.nodeType === 3 ? startContainer.parentNode : startContainer; }
javascript
{ "resource": "" }
q35945
train
function (targetNode, caretNode) { var targetBlock = editor.dom.getParent(targetNode, editor.dom.isBlock); var caretBlock = editor.dom.getParent(caretNode, editor.dom.isBlock); return targetBlock && !isInSameBlock(targetBlock, caretBlock) && hasNormalCaretPosition(targetBlock); }
javascript
{ "resource": "" }
q35946
Editor
train
function Editor(id, settings, editorManager) { var self = this, documentBaseUrl, baseUri, defaultSettings; documentBaseUrl = self.documentBaseUrl = editorManager.documentBaseURL; baseUri = editorManager.baseURI; defaultSettings = editorManager.defaultSettings; /** * Name/value col...
javascript
{ "resource": "" }
q35947
train
function (name) { var self = this, callback = self.settings[name], scope; if (!callback) { return; } // Look through lookup if (self.callbackLookup && (scope = self.callbackLookup[name])) { callback = scope.func; scope = scope.scope; } ...
javascript
{ "resource": "" }
q35948
train
function (name, defaultVal, type) { var value = name in this.settings ? this.settings[name] : defaultVal, output; if (type === 'hash') { output = {}; if (typeof value === 'string') { each(value.indexOf('=') > 0 ? value.split(/[;,](?![^=;,]*(?:[;,]|$))/) : value.split(',...
javascript
{ "resource": "" }
q35949
train
function (name, settings) { var self = this; if (settings.cmd) { settings.onclick = function () { self.execCommand(settings.cmd); }; } if (!settings.text && !settings.icon) { settings.icon = name; } self.buttons = self.buttons ...
javascript
{ "resource": "" }
q35950
train
function (name, settings) { var self = this; if (settings.cmd) { settings.onclick = function () { self.execCommand(settings.cmd); }; } self.menuItems = self.menuItems || {}; self.menuItems[name] = settings; }
javascript
{ "resource": "" }
q35951
train
function (predicate, items) { var self = this, selector; self.contextToolbars = self.contextToolbars || []; // Convert selector to predicate if (typeof predicate == "string") { selector = predicate; predicate = function (elm) { return self.dom.is(elm, se...
javascript
{ "resource": "" }
q35952
train
function (pattern, desc, cmdFunc, scope) { this.shortcuts.add(pattern, desc, cmdFunc, scope); }
javascript
{ "resource": "" }
q35953
train
function (cmd, ui, value, args) { return this.editorCommands.execCommand(cmd, ui, value, args); }
javascript
{ "resource": "" }
q35954
train
function (args) { var self = this, elm = self.getElement(), html; if (elm) { args = args || {}; args.load = true; html = self.setContent(elm.value !== undefined ? elm.value : elm.innerHTML, args); args.element = elm; if (!args.no_events) { ...
javascript
{ "resource": "" }
q35955
train
function (args) { var self = this, elm = self.getElement(), html, form; if (!elm || !self.initialized) { return; } args = args || {}; args.save = true; args.element = elm; html = args.content = self.getContent(args); if (!args.no_events) { ...
javascript
{ "resource": "" }
q35956
train
function (content, args) { var self = this, body = self.getBody(), forcedRootBlockName, padd; // Setup args object args = args || {}; args.format = args.format || 'html'; args.set = true; args.content = content; // Do preprocessing if (!args.no_events) {...
javascript
{ "resource": "" }
q35957
train
function (content, args) { if (args) { content = extend({ content: content }, args); } this.execCommand('mceInsertContent', false, content); }
javascript
{ "resource": "" }
q35958
train
function () { var self = this, elm; if (!self.contentWindow) { elm = self.iframeElement; if (elm) { self.contentWindow = elm.contentWindow; } } return self.contentWindow; }
javascript
{ "resource": "" }
q35959
train
function (url, name, elm) { var self = this, settings = self.settings; // Use callback instead if (settings.urlconverter_callback) { return self.execCallback('urlconverter_callback', url, elm, true, name); } // Don't convert link href since thats the CSS files that ge...
javascript
{ "resource": "" }
q35960
train
function (elm) { var self = this, settings = self.settings, dom = self.dom, cls; elm = elm || self.getBody(); if (self.hasVisual === undefined) { self.hasVisual = settings.visual; } each(dom.select('table,a', elm), function (elm) { var value; swi...
javascript
{ "resource": "" }
q35961
train
function () { var self = this; if (!self.removed) { self.save(); self.removed = 1; self.unbindAllNativeEvents(); // Remove any hidden input if (self.hasHiddenInput) { DOM.remove(self.getElement().nextSibling); } if (!se...
javascript
{ "resource": "" }
q35962
train
function (automatic) { var self = this, form; // One time is enough if (self.destroyed) { return; } // If user manually calls destroy and not remove // Users seems to have logic that calls destroy instead of remove if (!automatic && !self.removed) { ...
javascript
{ "resource": "" }
q35963
train
function (newCode) { if (newCode) { code = newCode; this.rtl = this.data[newCode] ? this.data[newCode]._dir === 'rtl' : false; } }
javascript
{ "resource": "" }
q35964
train
function (code, items) { var langData = data[code]; if (!langData) { data[code] = langData = {}; } for (var name in items) { langData[name] = items[name]; } this.setCode(code); }
javascript
{ "resource": "" }
q35965
train
function (text) { var langData = data[code] || {}; /** * number - string * null, undefined and empty string - empty string * array - comma-delimited string * object - in [object Object] * function - in [object Function] * * @param obj ...
javascript
{ "resource": "" }
q35966
train
function (defaultSettings) { var baseUrl, suffix; baseUrl = defaultSettings.base_url; if (baseUrl) { this.baseURL = new URI(this.documentBaseURL).toAbsolute(baseUrl.replace(/\/+$/, '')); this.baseURI = new URI(this.baseURL); } suffix = defaultSettings.suffix...
javascript
{ "resource": "" }
q35967
train
function (editor) { var self = this, editors = self.editors; // Add named and index editor instance editors[editor.id] = editor; editors.push(editor); toggleGlobalEvents(editors, true); // Doesn't call setActive method since we don't want // to fire a bunch of ...
javascript
{ "resource": "" }
q35968
train
function (selector) { var self = this, i, editors = self.editors, editor; // Remove all editors if (!selector) { for (i = editors.length - 1; i >= 0; i--) { self.remove(editors[i]); } return; } // Remove editors by selector if ...
javascript
{ "resource": "" }
q35969
train
function (cmd, ui, value) { var self = this, editor = self.get(value); // Manager commands switch (cmd) { case "mceAddEditor": if (!self.get(value)) { new Editor(value, self.settings, self).render(); } return true; case "mc...
javascript
{ "resource": "" }
q35970
load
train
function load() { var key, data, value, pos = 0; items = {}; // localStorage can be disabled on WebKit/Gecko so make a dummy storage if (!hasOldIEDataSupport) { return; } function next(end) { var value, nextPos; nextPos = end !== undefined ? pos + end : da...
javascript
{ "resource": "" }
q35971
save
train
function save() { var value, data = ''; // localStorage can be disabled on WebKit/Gecko so make a dummy storage if (!hasOldIEDataSupport) { return; } for (var key in items) { value = items[key]; data += (data ? ',' : '') + key.length.toString(32) + ',' + key + ','...
javascript
{ "resource": "" }
q35972
train
function (items) { var self = this, settings = self.settings, firstClass, lastClass, firstItem, lastItem; firstClass = settings.firstControlClass; lastClass = settings.lastControlClass; items.each(function (item) { item.classes.remove(firstClass).remove(lastClass).add(setting...
javascript
{ "resource": "" }
q35973
train
function (container) { var self = this, html = ''; self.applyClasses(container.items()); container.items().each(function (item) { html += item.renderHtml(); }); return html; }
javascript
{ "resource": "" }
q35974
train
function (settings) { var self = this, size; self._super(settings); settings = self.settings; size = self.settings.size; self.on('click mousedown', function (e) { e.preventDefault(); }); self.on('touchstart', function (e) { self.fire('click...
javascript
{ "resource": "" }
q35975
train
function () { var btnElm = this.getEl().firstChild, btnStyle; if (btnElm) { btnStyle = btnElm.style; btnStyle.width = btnStyle.height = "100%"; } this._super(); }
javascript
{ "resource": "" }
q35976
train
function (settings) { var self = this; self._super(settings); self.on('click mousedown', function (e) { e.preventDefault(); }); self.on('click', function (e) { e.preventDefault(); if (!self.disabled()) { self.checked(!self.checked());...
javascript
{ "resource": "" }
q35977
train
function () { var self = this, settings = self.settings; self.active(true); if (!self.panel) { var panelSettings = settings.panel; // Wrap panel in grid layout if type if specified // This makes it possible to add forms or other containers directly in the panel o...
javascript
{ "resource": "" }
q35978
train
function () { var self = this, items = self.items(); if (!self.settings.formItemDefaults) { self.settings.formItemDefaults = { layout: 'flex', autoResize: "overflow", defaults: { flex: 1 } }; } // Wrap any labeled items in FormIte...
javascript
{ "resource": "" }
q35979
train
function (html, callback) { var self = this, body = this.getEl().contentWindow.document.body; // Wait for iframe to initialize IE 10 takes time if (!body) { Delay.setTimeout(function () { self.html(html); }); } else { body.innerHTML = html; ...
javascript
{ "resource": "" }
q35980
train
function (toggle) { var self = this, menu; if (self.menu && self.menu.visible() && toggle !== false) { return self.hideMenu(); } if (!self.menu) { menu = self.state.get('menu') || []; // Is menu array then auto constuct menu control if (menu.len...
javascript
{ "resource": "" }
q35981
train
function () { var self = this; if (self.menu) { self.menu.items().each(function (item) { if (item.hideMenu) { item.hideMenu(); } }); self.menu.hide(); } }
javascript
{ "resource": "" }
q35982
train
function () { var self = this, settings = self.settings, menu, parent = self.parent(); parent.items().each(function (ctrl) { if (ctrl !== self) { ctrl.hideMenu(); } }); if (settings.menu) { menu = self.menu; if (!menu) { ...
javascript
{ "resource": "" }
q35983
train
function () { var self = this; if (self.menu) { self.menu.items().each(function (item) { if (item.hideMenu) { item.hideMenu(); } }); self.menu.hide(); self.aria('expanded', false); } return self; }
javascript
{ "resource": "" }
q35984
train
function () { var self = this, time, factory; function hideThrobber() { if (self.throbber) { self.throbber.hide(); self.throbber = null; } } factory = self.settings.itemsFactory; if (!factory) { return; } if...
javascript
{ "resource": "" }
q35985
train
function () { var self = this; self.items().each(function (ctrl) { var settings = ctrl.settings; if (settings.icon || settings.image || settings.selectable) { self._hasIcons = true; return false; } }); if (self.settings.itemsFactor...
javascript
{ "resource": "" }
q35986
train
function (idx) { var activeTabElm; if (this.activeTabId) { activeTabElm = this.getEl(this.activeTabId); $(activeTabElm).removeClass(this.classPrefix + 'active'); activeTabElm.setAttribute('aria-selected', "false"); } this.activeTabId = 't' + idx; ...
javascript
{ "resource": "" }
q35987
train
function (editor, size) { var toolbars = [], settings = editor.settings; var addToolbar = function (items) { if (items) { toolbars.push(createToolbar(editor, items, size)); return true; } }; // Convert toolbar array to multiple options if (Tools.isArra...
javascript
{ "resource": "" }
q35988
train
function (rng) { var bookmark = {}; var setupEndPoint = function (start) { var offsetNode, container, offset; container = rng[start ? 'startContainer' : 'endContainer']; offset = rng[start ? 'startOffset' : 'endOffset']; if (container.nodeType === 1) { offsetNode...
javascript
{ "resource": "" }
q35989
genReplacer
train
function genReplacer(nodeName) { var makeReplacementNode; if (typeof nodeName != 'function') { var stencilNode = nodeName.nodeType ? nodeName : doc.createElement(nodeName); makeReplacementNode = function (fill, matchIndex) { var clone = stencilNode.cloneNode(false); ...
javascript
{ "resource": "" }
q35990
train
function(xs, f) { for (var i = 0, len = xs.length; i < len; i++) { var x = xs[i]; f(x, i, xs); } }
javascript
{ "resource": "" }
q35991
train
function (scope, predicate) { var result = []; var dom = scope.dom(); var children = Arr.map(dom.childNodes, Element.fromDom); Arr.each(children, function (x) { if (predicate(x)) { result = result.concat([ x ]); } result = result.concat(filterDescendants(x, pre...
javascript
{ "resource": "" }
q35992
fixTableCaretPos
train
function fixTableCaretPos() { editor.on('KeyDown SetContent VisualAid', function () { var last; // Skip empty text nodes from the end for (last = editor.getBody().lastChild; last; last = last.previousSibling) { if (last.nodeType == 3) { if (last.nodeValue...
javascript
{ "resource": "" }
q35993
fixTableCellSelection
train
function fixTableCellSelection() { function tableCellSelected(ed, rng, n, currentCell) { // The decision of when a table cell is selected is somewhat involved. The fact that this code is // required is actually a pointer to the root cause of this bug. A cell is selected when the start ...
javascript
{ "resource": "" }
q35994
deleteTable
train
function deleteTable() { function placeCaretInCell(cell) { editor.selection.select(cell, true); editor.selection.collapse(true); } function clearCell(cell) { editor.$(cell).empty(); Utils.paddCell(cell); } editor.on('keydown', function (e...
javascript
{ "resource": "" }
q35995
styleTDTH
train
function styleTDTH(elm, name, value) { if (elm.tagName === "TD" || elm.tagName === "TH") { dom.setStyle(elm, name, value); } else { if (elm.children) { for (var i = 0; i < elm.children.length; i++) { styleTDTH(elm.children[i], name, v...
javascript
{ "resource": "" }
q35996
getTopEdge
train
function getTopEdge(index, row) { return { index: index, y: editor.dom.getPos(row).y }; }
javascript
{ "resource": "" }
q35997
getBottomEdge
train
function getBottomEdge(index, row) { return { index: index, y: editor.dom.getPos(row).y + row.offsetHeight }; }
javascript
{ "resource": "" }
q35998
getLeftEdge
train
function getLeftEdge(index, cell) { return { index: index, x: editor.dom.getPos(cell).x }; }
javascript
{ "resource": "" }
q35999
getRightEdge
train
function getRightEdge(index, cell) { return { index: index, x: editor.dom.getPos(cell).x + cell.offsetWidth }; }
javascript
{ "resource": "" }