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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
1,300 | mozilla-services/react-jsonschema-form | src/components/widgets/SelectWidget.js | processValue | function processValue(schema, value) {
// "enum" is a reserved word, so only "type" and "items" can be destructured
const { type, items } = schema;
if (value === "") {
return undefined;
} else if (type === "array" && items && nums.has(items.type)) {
return value.map(asNumber);
} else if (type === "boo... | javascript | function processValue(schema, value) {
// "enum" is a reserved word, so only "type" and "items" can be destructured
const { type, items } = schema;
if (value === "") {
return undefined;
} else if (type === "array" && items && nums.has(items.type)) {
return value.map(asNumber);
} else if (type === "boo... | [
"function",
"processValue",
"(",
"schema",
",",
"value",
")",
"{",
"// \"enum\" is a reserved word, so only \"type\" and \"items\" can be destructured",
"const",
"{",
"type",
",",
"items",
"}",
"=",
"schema",
";",
"if",
"(",
"value",
"===",
"\"\"",
")",
"{",
"return... | This is a silly limitation in the DOM where option change event values are
always retrieved as strings. | [
"This",
"is",
"a",
"silly",
"limitation",
"in",
"the",
"DOM",
"where",
"option",
"change",
"event",
"values",
"are",
"always",
"retrieved",
"as",
"strings",
"."
] | 1ee343d4654a6d98ac08ece97330ce2a3f9f1de3 | https://github.com/mozilla-services/react-jsonschema-form/blob/1ee343d4654a6d98ac08ece97330ce2a3f9f1de3/src/components/widgets/SelectWidget.js#L12-L36 |
1,301 | nosir/cleave.js | src/Cleave.js | function (element, opts) {
var owner = this;
var hasMultipleElements = false;
if (typeof element === 'string') {
owner.element = document.querySelector(element);
hasMultipleElements = document.querySelectorAll(element).length > 1;
} else {
if (typeof element.length !== 'undefined'... | javascript | function (element, opts) {
var owner = this;
var hasMultipleElements = false;
if (typeof element === 'string') {
owner.element = document.querySelector(element);
hasMultipleElements = document.querySelectorAll(element).length > 1;
} else {
if (typeof element.length !== 'undefined'... | [
"function",
"(",
"element",
",",
"opts",
")",
"{",
"var",
"owner",
"=",
"this",
";",
"var",
"hasMultipleElements",
"=",
"false",
";",
"if",
"(",
"typeof",
"element",
"===",
"'string'",
")",
"{",
"owner",
".",
"element",
"=",
"document",
".",
"querySelect... | Construct a new Cleave instance by passing the configuration object
@param {String | HTMLElement} element
@param {Object} opts | [
"Construct",
"a",
"new",
"Cleave",
"instance",
"by",
"passing",
"the",
"configuration",
"object"
] | fc1bcca55589e0e95465f39b4dc22c25634e7cf5 | https://github.com/nosir/cleave.js/blob/fc1bcca55589e0e95465f39b4dc22c25634e7cf5/src/Cleave.js#L9-L43 | |
1,302 | nhn/tui.editor | src/js/extensions/table/mergedTableAddRow.js | _findFocusTd | function _findFocusTd($newTable, rowIndex, colIndex) {
const tableData = dataHandler.createTableData($newTable);
const newRowIndex = dataHandler.findRowMergedLastIndex(tableData, rowIndex, colIndex) + 1;
const cellElementIndex = dataHandler.findElementIndex(tableData, newRowIndex, colIndex);
return $newTable.f... | javascript | function _findFocusTd($newTable, rowIndex, colIndex) {
const tableData = dataHandler.createTableData($newTable);
const newRowIndex = dataHandler.findRowMergedLastIndex(tableData, rowIndex, colIndex) + 1;
const cellElementIndex = dataHandler.findElementIndex(tableData, newRowIndex, colIndex);
return $newTable.f... | [
"function",
"_findFocusTd",
"(",
"$newTable",
",",
"rowIndex",
",",
"colIndex",
")",
"{",
"const",
"tableData",
"=",
"dataHandler",
".",
"createTableData",
"(",
"$newTable",
")",
";",
"const",
"newRowIndex",
"=",
"dataHandler",
".",
"findRowMergedLastIndex",
"(",
... | Find focus td element.
@param {jQuery} $newTable - changed table jQuery element
@param {number} rowIndex - row index of table data
@param {number} colIndex - column index of tabld data
@returns {HTMLElement}
@private | [
"Find",
"focus",
"td",
"element",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/mergedTableAddRow.js#L133-L139 |
1,303 | nhn/tui.editor | src/js/extensions/table/tableDataHandler.js | _parseCell | function _parseCell(cell, rowIndex, colIndex) {
const $cell = $(cell);
const colspan = $cell.attr('colspan');
const rowspan = $cell.attr('rowspan');
const {nodeName} = cell;
if (nodeName !== 'TH' && nodeName !== 'TD') {
return null;
}
const cellData = {
nodeName: cell.nodeName,
colspan: cols... | javascript | function _parseCell(cell, rowIndex, colIndex) {
const $cell = $(cell);
const colspan = $cell.attr('colspan');
const rowspan = $cell.attr('rowspan');
const {nodeName} = cell;
if (nodeName !== 'TH' && nodeName !== 'TD') {
return null;
}
const cellData = {
nodeName: cell.nodeName,
colspan: cols... | [
"function",
"_parseCell",
"(",
"cell",
",",
"rowIndex",
",",
"colIndex",
")",
"{",
"const",
"$cell",
"=",
"$",
"(",
"cell",
")",
";",
"const",
"colspan",
"=",
"$cell",
".",
"attr",
"(",
"'colspan'",
")",
";",
"const",
"rowspan",
"=",
"$cell",
".",
"a... | Parse cell like td or th.
@param {HTMLElement} cell - cell element like td or th
@param {number} rowIndex - row index
@param {number} colIndex - column index
@returns {{
nodeName: string,
colspan: number,
rowspan: number,
content: string,
align: ?string
}}
@private | [
"Parse",
"cell",
"like",
"td",
"or",
"th",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/tableDataHandler.js#L22-L48 |
1,304 | nhn/tui.editor | src/js/extensions/table/tableDataHandler.js | _addMergedCell | function _addMergedCell(base, cellData, startRowIndex, startCellIndex) {
const {
colspan,
rowspan,
nodeName
} = cellData;
const colMerged = colspan > 1;
const rowMerged = rowspan > 1;
if (!colMerged && !rowMerged) {
return;
}
const limitRowIndex = startRowIndex + rowspan;
const limitCe... | javascript | function _addMergedCell(base, cellData, startRowIndex, startCellIndex) {
const {
colspan,
rowspan,
nodeName
} = cellData;
const colMerged = colspan > 1;
const rowMerged = rowspan > 1;
if (!colMerged && !rowMerged) {
return;
}
const limitRowIndex = startRowIndex + rowspan;
const limitCe... | [
"function",
"_addMergedCell",
"(",
"base",
",",
"cellData",
",",
"startRowIndex",
",",
"startCellIndex",
")",
"{",
"const",
"{",
"colspan",
",",
"rowspan",
",",
"nodeName",
"}",
"=",
"cellData",
";",
"const",
"colMerged",
"=",
"colspan",
">",
"1",
";",
"co... | Add merged cell.
@param {object} base - base table data
@param {object} cellData - cell data
@param {number} startRowIndex - start row index
@param {number} startCellIndex - start cell index
@private | [
"Add",
"merged",
"cell",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/tableDataHandler.js#L58-L97 |
1,305 | nhn/tui.editor | src/js/extensions/table/tableDataHandler.js | _getHeaderAligns | function _getHeaderAligns(tableData) {
const [headRowData] = tableData;
return headRowData.map(cellData => {
let align;
if (util.isExisty(cellData.colMergeWith)) {
({align} = headRowData[cellData.colMergeWith]);
} else {
({align} = cellData);
}
return align;
});
} | javascript | function _getHeaderAligns(tableData) {
const [headRowData] = tableData;
return headRowData.map(cellData => {
let align;
if (util.isExisty(cellData.colMergeWith)) {
({align} = headRowData[cellData.colMergeWith]);
} else {
({align} = cellData);
}
return align;
});
} | [
"function",
"_getHeaderAligns",
"(",
"tableData",
")",
"{",
"const",
"[",
"headRowData",
"]",
"=",
"tableData",
";",
"return",
"headRowData",
".",
"map",
"(",
"cellData",
"=>",
"{",
"let",
"align",
";",
"if",
"(",
"util",
".",
"isExisty",
"(",
"cellData",
... | Get header aligns.
@param {Array.<Array.<object>>} tableData - table data
@returns {Array.<?string>}
@private | [
"Get",
"header",
"aligns",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/tableDataHandler.js#L170-L184 |
1,306 | nhn/tui.editor | src/js/extensions/table/tableDataHandler.js | createRenderData | function createRenderData(tableData, cellIndexData) {
const headerAligns = _getHeaderAligns(tableData);
const renderData = cellIndexData.map(row => row.map(({rowIndex, colIndex}) => (util.extend({
align: headerAligns[colIndex]
}, tableData[rowIndex][colIndex]))));
if (tableData.className) {
renderData.... | javascript | function createRenderData(tableData, cellIndexData) {
const headerAligns = _getHeaderAligns(tableData);
const renderData = cellIndexData.map(row => row.map(({rowIndex, colIndex}) => (util.extend({
align: headerAligns[colIndex]
}, tableData[rowIndex][colIndex]))));
if (tableData.className) {
renderData.... | [
"function",
"createRenderData",
"(",
"tableData",
",",
"cellIndexData",
")",
"{",
"const",
"headerAligns",
"=",
"_getHeaderAligns",
"(",
"tableData",
")",
";",
"const",
"renderData",
"=",
"cellIndexData",
".",
"map",
"(",
"row",
"=>",
"row",
".",
"map",
"(",
... | Create render data.
@param {Array.<object>} tableData - table data
@param {Array.<object>} cellIndexData - cell index data
@returns {Array.<Array.<object>>}
@ignore | [
"Create",
"render",
"data",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/tableDataHandler.js#L193-L204 |
1,307 | nhn/tui.editor | src/js/extensions/table/tableDataHandler.js | createBasicCell | function createBasicCell(rowIndex, colIndex, nodeName) {
return {
nodeName: nodeName || 'TD',
colspan: 1,
rowspan: 1,
content: BASIC_CELL_CONTENT,
elementIndex: {
rowIndex,
colIndex
}
};
} | javascript | function createBasicCell(rowIndex, colIndex, nodeName) {
return {
nodeName: nodeName || 'TD',
colspan: 1,
rowspan: 1,
content: BASIC_CELL_CONTENT,
elementIndex: {
rowIndex,
colIndex
}
};
} | [
"function",
"createBasicCell",
"(",
"rowIndex",
",",
"colIndex",
",",
"nodeName",
")",
"{",
"return",
"{",
"nodeName",
":",
"nodeName",
"||",
"'TD'",
",",
"colspan",
":",
"1",
",",
"rowspan",
":",
"1",
",",
"content",
":",
"BASIC_CELL_CONTENT",
",",
"eleme... | Create basic cell data.
@param {number} rowIndex - row index
@param {number} colIndex - column index
@param {string} nodeName - node name
@returns {{
nodeName: string,
colspan: number,
rowspan: number,
content: string
}}
@ignore | [
"Create",
"basic",
"cell",
"data",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/tableDataHandler.js#L221-L232 |
1,308 | nhn/tui.editor | src/js/extensions/table/tableDataHandler.js | findElementIndex | function findElementIndex(tableData, rowIndex, colIndex) {
const cellData = tableData[rowIndex][colIndex];
rowIndex = util.isExisty(cellData.rowMergeWith) ? cellData.rowMergeWith : rowIndex;
colIndex = util.isExisty(cellData.colMergeWith) ? cellData.colMergeWith : colIndex;
return tableData[rowIndex][colIndex... | javascript | function findElementIndex(tableData, rowIndex, colIndex) {
const cellData = tableData[rowIndex][colIndex];
rowIndex = util.isExisty(cellData.rowMergeWith) ? cellData.rowMergeWith : rowIndex;
colIndex = util.isExisty(cellData.colMergeWith) ? cellData.colMergeWith : colIndex;
return tableData[rowIndex][colIndex... | [
"function",
"findElementIndex",
"(",
"tableData",
",",
"rowIndex",
",",
"colIndex",
")",
"{",
"const",
"cellData",
"=",
"tableData",
"[",
"rowIndex",
"]",
"[",
"colIndex",
"]",
";",
"rowIndex",
"=",
"util",
".",
"isExisty",
"(",
"cellData",
".",
"rowMergeWit... | Find cell element index.
@param {Array.<Array.<object>>} tableData - tableData data
@param {number} rowIndex - row index of base data
@param {number} colIndex - col index of base data
@returns {{rowIndex: number, colIndex: number}}
@ignore | [
"Find",
"cell",
"element",
"index",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/tableDataHandler.js#L321-L328 |
1,309 | nhn/tui.editor | src/js/extensions/table/tableDataHandler.js | stuffCellsIntoIncompleteRow | function stuffCellsIntoIncompleteRow(tableData, limitIndex) {
tableData.forEach((rowData, rowIndex) => {
const startIndex = rowData.length;
if (startIndex) {
const [{nodeName}] = rowData;
util.range(startIndex, limitIndex).forEach(colIndex => {
rowData.push(createBasicCell(rowIndex, colIn... | javascript | function stuffCellsIntoIncompleteRow(tableData, limitIndex) {
tableData.forEach((rowData, rowIndex) => {
const startIndex = rowData.length;
if (startIndex) {
const [{nodeName}] = rowData;
util.range(startIndex, limitIndex).forEach(colIndex => {
rowData.push(createBasicCell(rowIndex, colIn... | [
"function",
"stuffCellsIntoIncompleteRow",
"(",
"tableData",
",",
"limitIndex",
")",
"{",
"tableData",
".",
"forEach",
"(",
"(",
"rowData",
",",
"rowIndex",
")",
"=>",
"{",
"const",
"startIndex",
"=",
"rowData",
".",
"length",
";",
"if",
"(",
"startIndex",
"... | Stuff cells into incomplete row.
@param {Array.<Array.<object>>} tableData - table data
@param {number} limitIndex - limit index
@ignore | [
"Stuff",
"cells",
"into",
"incomplete",
"row",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/tableDataHandler.js#L336-L347 |
1,310 | nhn/tui.editor | src/js/extensions/table/tableDataHandler.js | addTbodyOrTheadIfNeed | function addTbodyOrTheadIfNeed(tableData) {
const [header] = tableData;
const cellCount = header.length;
let added = true;
if (!cellCount && tableData[1]) {
util.range(0, tableData[1].length).forEach(colIndex => {
header.push(createBasicCell(0, colIndex, 'TH'));
});
} else if (tableData[0][0].n... | javascript | function addTbodyOrTheadIfNeed(tableData) {
const [header] = tableData;
const cellCount = header.length;
let added = true;
if (!cellCount && tableData[1]) {
util.range(0, tableData[1].length).forEach(colIndex => {
header.push(createBasicCell(0, colIndex, 'TH'));
});
} else if (tableData[0][0].n... | [
"function",
"addTbodyOrTheadIfNeed",
"(",
"tableData",
")",
"{",
"const",
"[",
"header",
"]",
"=",
"tableData",
";",
"const",
"cellCount",
"=",
"header",
".",
"length",
";",
"let",
"added",
"=",
"true",
";",
"if",
"(",
"!",
"cellCount",
"&&",
"tableData",
... | Add tbody or thead of table data if need.
@param {Array.<Array.<object>>} tableData - table data
@returns {boolean}
@ignore | [
"Add",
"tbody",
"or",
"thead",
"of",
"table",
"data",
"if",
"need",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/tableDataHandler.js#L355-L385 |
1,311 | nhn/tui.editor | src/js/wysiwygCommands/italic.js | styleItalic | function styleItalic(sq) {
if (sq.hasFormat('i') || sq.hasFormat('em')) {
sq.changeFormat(null, {tag: 'i'});
} else if (!sq.hasFormat('a') && !sq.hasFormat('PRE')) {
if (sq.hasFormat('code')) {
sq.changeFormat(null, {tag: 'code'});
}
sq.italic();
}
} | javascript | function styleItalic(sq) {
if (sq.hasFormat('i') || sq.hasFormat('em')) {
sq.changeFormat(null, {tag: 'i'});
} else if (!sq.hasFormat('a') && !sq.hasFormat('PRE')) {
if (sq.hasFormat('code')) {
sq.changeFormat(null, {tag: 'code'});
}
sq.italic();
}
} | [
"function",
"styleItalic",
"(",
"sq",
")",
"{",
"if",
"(",
"sq",
".",
"hasFormat",
"(",
"'i'",
")",
"||",
"sq",
".",
"hasFormat",
"(",
"'em'",
")",
")",
"{",
"sq",
".",
"changeFormat",
"(",
"null",
",",
"{",
"tag",
":",
"'i'",
"}",
")",
";",
"}... | Style italic.
@param {object} sq - squire editor instance | [
"Style",
"italic",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/italic.js#L44-L53 |
1,312 | nhn/tui.editor | src/js/extensions/table/mergeCell.js | _pickContent | function _pickContent(targetRows, startColIndex, endColIndex) {
const limitColIndex = endColIndex + 1;
const cells = [].concat(...targetRows.map(rowData => rowData.slice(startColIndex, limitColIndex)));
const foundCellData = cells.filter(({content}) => content && content !== BASIC_CELL_CONTENT);
return foundCe... | javascript | function _pickContent(targetRows, startColIndex, endColIndex) {
const limitColIndex = endColIndex + 1;
const cells = [].concat(...targetRows.map(rowData => rowData.slice(startColIndex, limitColIndex)));
const foundCellData = cells.filter(({content}) => content && content !== BASIC_CELL_CONTENT);
return foundCe... | [
"function",
"_pickContent",
"(",
"targetRows",
",",
"startColIndex",
",",
"endColIndex",
")",
"{",
"const",
"limitColIndex",
"=",
"endColIndex",
"+",
"1",
";",
"const",
"cells",
"=",
"[",
"]",
".",
"concat",
"(",
"...",
"targetRows",
".",
"map",
"(",
"rowD... | Pick merger content from selected cells.
@param {Array.<Array.<object>>} targetRows - target rows
@param {number} startColIndex - start column index
@param {number} endColIndex - end column index
@returns {string}
@private | [
"Pick",
"merger",
"content",
"from",
"selected",
"cells",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/mergeCell.js#L64-L70 |
1,313 | nhn/tui.editor | src/js/extensions/table/mergeCell.js | _initCellData | function _initCellData(targetRows, startColIndex, endColIndex) {
const limitColIndex = endColIndex + 1;
const targetCells = targetRows.map(rowData => rowData.slice(startColIndex, limitColIndex));
[].concat(...targetCells).slice(1).forEach(cellData => {
const {nodeName} = cellData;
util.forEach(cellData,... | javascript | function _initCellData(targetRows, startColIndex, endColIndex) {
const limitColIndex = endColIndex + 1;
const targetCells = targetRows.map(rowData => rowData.slice(startColIndex, limitColIndex));
[].concat(...targetCells).slice(1).forEach(cellData => {
const {nodeName} = cellData;
util.forEach(cellData,... | [
"function",
"_initCellData",
"(",
"targetRows",
",",
"startColIndex",
",",
"endColIndex",
")",
"{",
"const",
"limitColIndex",
"=",
"endColIndex",
"+",
"1",
";",
"const",
"targetCells",
"=",
"targetRows",
".",
"map",
"(",
"rowData",
"=>",
"rowData",
".",
"slice... | Initialize cell data of target rows.
@param {Array.<Array.<object>>} targetRows - target rows
@param {number} startColIndex - start column index
@param {number} endColIndex - end column index
@private | [
"Initialize",
"cell",
"data",
"of",
"target",
"rows",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/mergeCell.js#L79-L89 |
1,314 | nhn/tui.editor | src/js/extensions/table/mergeCell.js | _updateRowMergeWith | function _updateRowMergeWith(targetRows, startColIndex, endColIndex, rowMergeWith) {
const limitColIndex = endColIndex + 1;
targetRows.forEach(rowData => {
rowData.slice(startColIndex, limitColIndex).forEach(cellData => {
cellData.rowMergeWith = rowMergeWith;
});
});
} | javascript | function _updateRowMergeWith(targetRows, startColIndex, endColIndex, rowMergeWith) {
const limitColIndex = endColIndex + 1;
targetRows.forEach(rowData => {
rowData.slice(startColIndex, limitColIndex).forEach(cellData => {
cellData.rowMergeWith = rowMergeWith;
});
});
} | [
"function",
"_updateRowMergeWith",
"(",
"targetRows",
",",
"startColIndex",
",",
"endColIndex",
",",
"rowMergeWith",
")",
"{",
"const",
"limitColIndex",
"=",
"endColIndex",
"+",
"1",
";",
"targetRows",
".",
"forEach",
"(",
"rowData",
"=>",
"{",
"rowData",
".",
... | Update rowMergeWith property of target rows for row merge.
@param {Array.<Array.<object>>} targetRows - target rows
@param {number} startColIndex - start column index
@param {number} endColIndex - end column index
@param {number} rowMergeWith - index of row merger
@private | [
"Update",
"rowMergeWith",
"property",
"of",
"target",
"rows",
"for",
"row",
"merge",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/mergeCell.js#L99-L107 |
1,315 | nhn/tui.editor | src/js/extensions/table/mergeCell.js | _updateColMergeWith | function _updateColMergeWith(targetRows, startColIndex, endColIndex, colMergeWith) {
const limitColIndex = endColIndex + 1;
targetRows.forEach(rowData => {
rowData.slice(startColIndex, limitColIndex).forEach(cellData => {
cellData.colMergeWith = colMergeWith;
});
});
} | javascript | function _updateColMergeWith(targetRows, startColIndex, endColIndex, colMergeWith) {
const limitColIndex = endColIndex + 1;
targetRows.forEach(rowData => {
rowData.slice(startColIndex, limitColIndex).forEach(cellData => {
cellData.colMergeWith = colMergeWith;
});
});
} | [
"function",
"_updateColMergeWith",
"(",
"targetRows",
",",
"startColIndex",
",",
"endColIndex",
",",
"colMergeWith",
")",
"{",
"const",
"limitColIndex",
"=",
"endColIndex",
"+",
"1",
";",
"targetRows",
".",
"forEach",
"(",
"rowData",
"=>",
"{",
"rowData",
".",
... | Update colMergeWith property of target rows for column merge.
@param {Array.<Array.<object>>} targetRows - target rows
@param {number} startColIndex - start column index
@param {number} endColIndex - end column index
@param {number} colMergeWith - index of column merger
@private | [
"Update",
"colMergeWith",
"property",
"of",
"target",
"rows",
"for",
"column",
"merge",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/mergeCell.js#L117-L125 |
1,316 | nhn/tui.editor | src/js/wysiwygCommands/tableRemoveRow.js | focusToFirstTd | function focusToFirstTd(sq, range, $tr, tableMgr) {
const nextFocusCell = $tr.find('td').get(0);
range.setStart(nextFocusCell, 0);
range.collapse(true);
tableMgr.setLastCellNode(nextFocusCell);
sq.setSelection(range);
} | javascript | function focusToFirstTd(sq, range, $tr, tableMgr) {
const nextFocusCell = $tr.find('td').get(0);
range.setStart(nextFocusCell, 0);
range.collapse(true);
tableMgr.setLastCellNode(nextFocusCell);
sq.setSelection(range);
} | [
"function",
"focusToFirstTd",
"(",
"sq",
",",
"range",
",",
"$tr",
",",
"tableMgr",
")",
"{",
"const",
"nextFocusCell",
"=",
"$tr",
".",
"find",
"(",
"'td'",
")",
".",
"get",
"(",
"0",
")",
";",
"range",
".",
"setStart",
"(",
"nextFocusCell",
",",
"0... | Focus to first TD in given TR
@param {SquireExt} sq Squire instance
@param {Range} range Range object
@param {jQuery} $tr jQuery wrapped TR
@param {object} tableMgr Table manager | [
"Focus",
"to",
"first",
"TD",
"in",
"given",
"TR"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/tableRemoveRow.js#L53-L60 |
1,317 | nhn/tui.editor | src/js/wysiwygCommands/tableRemoveRow.js | getSelectedRows | function getSelectedRows(firstSelectedCell, rangeInformation, $table) {
const tbodyRowLength = $table.find('tbody tr').length;
const isStartContainerInThead = $(firstSelectedCell).parents('thead').length;
let startRowIndex = rangeInformation.from.row;
let endRowIndex = rangeInformation.to.row;
if (isStartCon... | javascript | function getSelectedRows(firstSelectedCell, rangeInformation, $table) {
const tbodyRowLength = $table.find('tbody tr').length;
const isStartContainerInThead = $(firstSelectedCell).parents('thead').length;
let startRowIndex = rangeInformation.from.row;
let endRowIndex = rangeInformation.to.row;
if (isStartCon... | [
"function",
"getSelectedRows",
"(",
"firstSelectedCell",
",",
"rangeInformation",
",",
"$table",
")",
"{",
"const",
"tbodyRowLength",
"=",
"$table",
".",
"find",
"(",
"'tbody tr'",
")",
".",
"length",
";",
"const",
"isStartContainerInThead",
"=",
"$",
"(",
"firs... | Get start, end row index from current range
@param {HTMLElement} firstSelectedCell Range object
@param {object} rangeInformation Range information object
@param {jQuery} $table jquery wrapped TABLE
@returns {jQuery} | [
"Get",
"start",
"end",
"row",
"index",
"from",
"current",
"range"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/tableRemoveRow.js#L69-L86 |
1,318 | nhn/tui.editor | src/js/extensions/table/table.js | _changeWysiwygManagers | function _changeWysiwygManagers(wwComponentManager) {
wwComponentManager.removeManager('table');
wwComponentManager.removeManager('tableSelection');
wwComponentManager.addManager(WwMergedTableManager);
wwComponentManager.addManager(WwMergedTableSelectionManager);
} | javascript | function _changeWysiwygManagers(wwComponentManager) {
wwComponentManager.removeManager('table');
wwComponentManager.removeManager('tableSelection');
wwComponentManager.addManager(WwMergedTableManager);
wwComponentManager.addManager(WwMergedTableSelectionManager);
} | [
"function",
"_changeWysiwygManagers",
"(",
"wwComponentManager",
")",
"{",
"wwComponentManager",
".",
"removeManager",
"(",
"'table'",
")",
";",
"wwComponentManager",
".",
"removeManager",
"(",
"'tableSelection'",
")",
";",
"wwComponentManager",
".",
"addManager",
"(",
... | Change wysiwyg component managers.
@param {object} wwComponentManager - componentMananger instance
@private | [
"Change",
"wysiwyg",
"component",
"managers",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/table.js#L65-L71 |
1,319 | nhn/tui.editor | src/js/extensions/table/table.js | _changeHtml | function _changeHtml(html, onChangeTable) {
const $tempDiv = $(`<div>${html}</div>`);
const $tables = $tempDiv.find('table');
if ($tables.length) {
$tables.get().forEach(tableElement => {
const changedTableElement = onChangeTable(tableElement);
$(tableElement).replaceWith(changedTableElement);
... | javascript | function _changeHtml(html, onChangeTable) {
const $tempDiv = $(`<div>${html}</div>`);
const $tables = $tempDiv.find('table');
if ($tables.length) {
$tables.get().forEach(tableElement => {
const changedTableElement = onChangeTable(tableElement);
$(tableElement).replaceWith(changedTableElement);
... | [
"function",
"_changeHtml",
"(",
"html",
",",
"onChangeTable",
")",
"{",
"const",
"$tempDiv",
"=",
"$",
"(",
"`",
"${",
"html",
"}",
"`",
")",
";",
"const",
"$tables",
"=",
"$tempDiv",
".",
"find",
"(",
"'table'",
")",
";",
"if",
"(",
"$tables",
".",
... | Change html by onChangeTable function.
@param {string} html - original html
@param {function} onChangeTable - function for changing html
@returns {string}
@private | [
"Change",
"html",
"by",
"onChangeTable",
"function",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/table.js#L80-L95 |
1,320 | nhn/tui.editor | src/js/extensions/table/table.js | _snatchWysiwygCommand | function _snatchWysiwygCommand(commandWrapper) {
const {command} = commandWrapper;
if (!command.isWWType()) {
return;
}
switch (command.getName()) {
case 'AddRow':
commandWrapper.command = wwAddRow;
break;
case 'AddCol':
commandWrapper.command = wwAddCol;
break;
case 'RemoveRow':
... | javascript | function _snatchWysiwygCommand(commandWrapper) {
const {command} = commandWrapper;
if (!command.isWWType()) {
return;
}
switch (command.getName()) {
case 'AddRow':
commandWrapper.command = wwAddRow;
break;
case 'AddCol':
commandWrapper.command = wwAddCol;
break;
case 'RemoveRow':
... | [
"function",
"_snatchWysiwygCommand",
"(",
"commandWrapper",
")",
"{",
"const",
"{",
"command",
"}",
"=",
"commandWrapper",
";",
"if",
"(",
"!",
"command",
".",
"isWWType",
"(",
")",
")",
"{",
"return",
";",
"}",
"switch",
"(",
"command",
".",
"getName",
... | Snatch wysiwyg command.
@param {{command: object}} commandWrapper - wysiwyg command wrapper
@private | [
"Snatch",
"wysiwyg",
"command",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/table.js#L102-L127 |
1,321 | nhn/tui.editor | src/js/extensions/table/table.js | _bindEvents | function _bindEvents(eventManager) {
eventManager.listen('convertorAfterMarkdownToHtmlConverted', html => _changeHtml(html, createMergedTable));
eventManager.listen('convertorBeforeHtmlToMarkdownConverted', html => _changeHtml(html, prepareTableUnmerge));
eventManager.listen('addCommandBefore', _snatchWysiwygComm... | javascript | function _bindEvents(eventManager) {
eventManager.listen('convertorAfterMarkdownToHtmlConverted', html => _changeHtml(html, createMergedTable));
eventManager.listen('convertorBeforeHtmlToMarkdownConverted', html => _changeHtml(html, prepareTableUnmerge));
eventManager.listen('addCommandBefore', _snatchWysiwygComm... | [
"function",
"_bindEvents",
"(",
"eventManager",
")",
"{",
"eventManager",
".",
"listen",
"(",
"'convertorAfterMarkdownToHtmlConverted'",
",",
"html",
"=>",
"_changeHtml",
"(",
"html",
",",
"createMergedTable",
")",
")",
";",
"eventManager",
".",
"listen",
"(",
"'c... | Bind events.
@param {object} eventManager - eventManager instance
@private | [
"Bind",
"events",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/table.js#L134-L138 |
1,322 | nhn/tui.editor | src/js/codemirror/continuelist.js | incrementRemainingMarkdownListNumbers | function incrementRemainingMarkdownListNumbers(cm, pos) {
var startLine = pos.line, lookAhead = 0, skipCount = 0;
var startItem = listRE.exec(cm.getLine(startLine)), startIndent = startItem[1];
do {
lookAhead += 1;
var nextLineNumber = startLine + lookAhead;
var nextLine = cm.getLine(nextLineNumber),... | javascript | function incrementRemainingMarkdownListNumbers(cm, pos) {
var startLine = pos.line, lookAhead = 0, skipCount = 0;
var startItem = listRE.exec(cm.getLine(startLine)), startIndent = startItem[1];
do {
lookAhead += 1;
var nextLineNumber = startLine + lookAhead;
var nextLine = cm.getLine(nextLineNumber),... | [
"function",
"incrementRemainingMarkdownListNumbers",
"(",
"cm",
",",
"pos",
")",
"{",
"var",
"startLine",
"=",
"pos",
".",
"line",
",",
"lookAhead",
"=",
"0",
",",
"skipCount",
"=",
"0",
";",
"var",
"startItem",
"=",
"listRE",
".",
"exec",
"(",
"cm",
"."... | Auto-updating Markdown list numbers when a new item is added to the middle of a list | [
"Auto",
"-",
"updating",
"Markdown",
"list",
"numbers",
"when",
"a",
"new",
"item",
"is",
"added",
"to",
"the",
"middle",
"of",
"a",
"list"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/codemirror/continuelist.js#L67-L100 |
1,323 | nhn/tui.editor | src/js/codemirror/fixOrderedListNumber.js | fixNumber | function fixNumber(lineNumber, prevIndentLength, startIndex, cm) {
let indent, delimiter, text, indentLength;
let index = startIndex;
let lineText = cm.getLine(lineNumber);
do {
[, indent, , , delimiter, text] = listRE.exec(lineText);
indentLength = indent.length;
if (indentLength === prevIndentLe... | javascript | function fixNumber(lineNumber, prevIndentLength, startIndex, cm) {
let indent, delimiter, text, indentLength;
let index = startIndex;
let lineText = cm.getLine(lineNumber);
do {
[, indent, , , delimiter, text] = listRE.exec(lineText);
indentLength = indent.length;
if (indentLength === prevIndentLe... | [
"function",
"fixNumber",
"(",
"lineNumber",
",",
"prevIndentLength",
",",
"startIndex",
",",
"cm",
")",
"{",
"let",
"indent",
",",
"delimiter",
",",
"text",
",",
"indentLength",
";",
"let",
"index",
"=",
"startIndex",
";",
"let",
"lineText",
"=",
"cm",
"."... | fix list numbers
@param {number} lineNumber - line number of list item to be normalized
@param {number} prevIndentLength - previous indent length
@param {number} startIndex - start index
@param {CodeMirror} cm - CodeMirror instance
@returns {number} - next line number
@ignore | [
"fix",
"list",
"numbers"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/codemirror/fixOrderedListNumber.js#L62-L94 |
1,324 | nhn/tui.editor | src/js/codemirror/fixOrderedListNumber.js | findFirstListItem | function findFirstListItem(lineNumber, cm) {
let nextLineNumber = lineNumber;
let lineText = cm.getLine(lineNumber);
while (listRE.test(lineText)) {
nextLineNumber -= 1;
lineText = cm.getLine(nextLineNumber);
}
if (lineNumber === nextLineNumber) {
nextLineNumber = -1;
} else {
nextLineNumb... | javascript | function findFirstListItem(lineNumber, cm) {
let nextLineNumber = lineNumber;
let lineText = cm.getLine(lineNumber);
while (listRE.test(lineText)) {
nextLineNumber -= 1;
lineText = cm.getLine(nextLineNumber);
}
if (lineNumber === nextLineNumber) {
nextLineNumber = -1;
} else {
nextLineNumb... | [
"function",
"findFirstListItem",
"(",
"lineNumber",
",",
"cm",
")",
"{",
"let",
"nextLineNumber",
"=",
"lineNumber",
";",
"let",
"lineText",
"=",
"cm",
".",
"getLine",
"(",
"lineNumber",
")",
";",
"while",
"(",
"listRE",
".",
"test",
"(",
"lineText",
")",
... | find line number of list item which contains given lineNumber
@param {number} lineNumber - line number of list item
@param {CodeMirror} cm - CodeMirror instance
@returns {number} - line number of first list item
@ignore | [
"find",
"line",
"number",
"of",
"list",
"item",
"which",
"contains",
"given",
"lineNumber"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/codemirror/fixOrderedListNumber.js#L103-L119 |
1,325 | nhn/tui.editor | src/js/wysiwygCommands/strike.js | styleStrike | function styleStrike(sq) {
if (sq.hasFormat('S')) {
sq.changeFormat(null, {tag: 'S'});
} else if (!sq.hasFormat('a') && !sq.hasFormat('PRE')) {
if (sq.hasFormat('code')) {
sq.changeFormat(null, {tag: 'code'});
}
sq.strikethrough();
}
} | javascript | function styleStrike(sq) {
if (sq.hasFormat('S')) {
sq.changeFormat(null, {tag: 'S'});
} else if (!sq.hasFormat('a') && !sq.hasFormat('PRE')) {
if (sq.hasFormat('code')) {
sq.changeFormat(null, {tag: 'code'});
}
sq.strikethrough();
}
} | [
"function",
"styleStrike",
"(",
"sq",
")",
"{",
"if",
"(",
"sq",
".",
"hasFormat",
"(",
"'S'",
")",
")",
"{",
"sq",
".",
"changeFormat",
"(",
"null",
",",
"{",
"tag",
":",
"'S'",
"}",
")",
";",
"}",
"else",
"if",
"(",
"!",
"sq",
".",
"hasFormat... | Style strike.
@param {object} sq - squire editor instance | [
"Style",
"strike",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/strike.js#L44-L53 |
1,326 | nhn/tui.editor | src/js/extensions/table/mergedTableAddCol.js | _createNewCell | function _createNewCell(rowData, rowIndex, colIndex, prevCell) {
const cellData = rowData[colIndex];
let newCell;
if (util.isExisty(cellData.colMergeWith)) {
const {colMergeWith} = cellData;
const merger = rowData[colMergeWith];
const lastMergedCellIndex = colMergeWith + merger.colspan - 1;
if (... | javascript | function _createNewCell(rowData, rowIndex, colIndex, prevCell) {
const cellData = rowData[colIndex];
let newCell;
if (util.isExisty(cellData.colMergeWith)) {
const {colMergeWith} = cellData;
const merger = rowData[colMergeWith];
const lastMergedCellIndex = colMergeWith + merger.colspan - 1;
if (... | [
"function",
"_createNewCell",
"(",
"rowData",
",",
"rowIndex",
",",
"colIndex",
",",
"prevCell",
")",
"{",
"const",
"cellData",
"=",
"rowData",
"[",
"colIndex",
"]",
";",
"let",
"newCell",
";",
"if",
"(",
"util",
".",
"isExisty",
"(",
"cellData",
".",
"c... | Create new cell data.
@param {Array.<object>} rowData - row data of table data
@param {number} rowIndex - row index of table data
@param {number} colIndex - column index of table data
@param {object | null} prevCell - previous cell data
@returns {object}
@private | [
"Create",
"new",
"cell",
"data",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/mergedTableAddCol.js#L77-L102 |
1,327 | nhn/tui.editor | src/js/extensions/table/mergedTableRemoveRow.js | _updateRowspan | function _updateRowspan(tableData, startRowIndex, endRowIndex) {
util.range(startRowIndex, endRowIndex + 1).forEach(rowIndex => {
tableData[rowIndex].forEach((cell, cellIndex) => {
if (util.isExisty(cell.rowMergeWith)) {
const merger = tableData[cell.rowMergeWith][cellIndex];
if (merger.row... | javascript | function _updateRowspan(tableData, startRowIndex, endRowIndex) {
util.range(startRowIndex, endRowIndex + 1).forEach(rowIndex => {
tableData[rowIndex].forEach((cell, cellIndex) => {
if (util.isExisty(cell.rowMergeWith)) {
const merger = tableData[cell.rowMergeWith][cellIndex];
if (merger.row... | [
"function",
"_updateRowspan",
"(",
"tableData",
",",
"startRowIndex",
",",
"endRowIndex",
")",
"{",
"util",
".",
"range",
"(",
"startRowIndex",
",",
"endRowIndex",
"+",
"1",
")",
".",
"forEach",
"(",
"rowIndex",
"=>",
"{",
"tableData",
"[",
"rowIndex",
"]",
... | Update rowspan to row merger.
@param {Array.<Array.<object>>} tableData - table data
@param {number} startRowIndex - start row index
@param {number} endRowIndex - end row index
@private | [
"Update",
"rowspan",
"to",
"row",
"merger",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/mergedTableRemoveRow.js#L64-L84 |
1,328 | nhn/tui.editor | src/js/extensions/colorSyntax.js | wrapTextAndGetRange | function wrapTextAndGetRange(pre, text, post) {
return {
result: `${pre}${text}${post}`,
from: pre.length,
to: pre.length + text.length
};
} | javascript | function wrapTextAndGetRange(pre, text, post) {
return {
result: `${pre}${text}${post}`,
from: pre.length,
to: pre.length + text.length
};
} | [
"function",
"wrapTextAndGetRange",
"(",
"pre",
",",
"text",
",",
"post",
")",
"{",
"return",
"{",
"result",
":",
"`",
"${",
"pre",
"}",
"${",
"text",
"}",
"${",
"post",
"}",
"`",
",",
"from",
":",
"pre",
".",
"length",
",",
"to",
":",
"pre",
".",... | wrap text with pre & post and return with text range
@param {string} pre - text pre
@param {string} text - text
@param {string} post - text post
@returns {object} - wrapped text and range(from, to)
@ignore | [
"wrap",
"text",
"with",
"pre",
"&",
"post",
"and",
"return",
"with",
"text",
"range"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/colorSyntax.js#L276-L282 |
1,329 | nhn/tui.editor | src/js/extensions/colorSyntax.js | changeDecColorsToHex | function changeDecColorsToHex(color) {
return color.replace(decimalColorRx, (colorValue, r, g, b) => {
const hr = changeDecColorToHex(r);
const hg = changeDecColorToHex(g);
const hb = changeDecColorToHex(b);
return `#${hr}${hg}${hb}`;
});
} | javascript | function changeDecColorsToHex(color) {
return color.replace(decimalColorRx, (colorValue, r, g, b) => {
const hr = changeDecColorToHex(r);
const hg = changeDecColorToHex(g);
const hb = changeDecColorToHex(b);
return `#${hr}${hg}${hb}`;
});
} | [
"function",
"changeDecColorsToHex",
"(",
"color",
")",
"{",
"return",
"color",
".",
"replace",
"(",
"decimalColorRx",
",",
"(",
"colorValue",
",",
"r",
",",
"g",
",",
"b",
")",
"=>",
"{",
"const",
"hr",
"=",
"changeDecColorToHex",
"(",
"r",
")",
";",
"... | Change decimal color values to hexadecimal color value
@param {string} color Color value string
@returns {string}
@ignore | [
"Change",
"decimal",
"color",
"values",
"to",
"hexadecimal",
"color",
"value"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/colorSyntax.js#L290-L298 |
1,330 | nhn/tui.editor | src/js/extensions/colorSyntax.js | changeDecColorToHex | function changeDecColorToHex(color) {
let hexColor = parseInt(color, 10);
hexColor = hexColor.toString(16);
hexColor = doubleZeroPad(hexColor);
return hexColor;
} | javascript | function changeDecColorToHex(color) {
let hexColor = parseInt(color, 10);
hexColor = hexColor.toString(16);
hexColor = doubleZeroPad(hexColor);
return hexColor;
} | [
"function",
"changeDecColorToHex",
"(",
"color",
")",
"{",
"let",
"hexColor",
"=",
"parseInt",
"(",
"color",
",",
"10",
")",
";",
"hexColor",
"=",
"hexColor",
".",
"toString",
"(",
"16",
")",
";",
"hexColor",
"=",
"doubleZeroPad",
"(",
"hexColor",
")",
"... | change individual dec color value to hex color
@param {string} color - individual color value
@returns {string} - zero padded color string
@ignore | [
"change",
"individual",
"dec",
"color",
"value",
"to",
"hex",
"color"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/colorSyntax.js#L306-L312 |
1,331 | nhn/tui.editor | src/js/wysiwygCommands/code.js | removeUnnecessaryCodeInNextToRange | function removeUnnecessaryCodeInNextToRange(range) {
if (domUtils.getNodeName(range.startContainer.nextSibling) === 'CODE'
&& domUtils.getTextLength(range.startContainer.nextSibling) === 0
) {
$(range.startContainer.nextSibling).remove();
}
} | javascript | function removeUnnecessaryCodeInNextToRange(range) {
if (domUtils.getNodeName(range.startContainer.nextSibling) === 'CODE'
&& domUtils.getTextLength(range.startContainer.nextSibling) === 0
) {
$(range.startContainer.nextSibling).remove();
}
} | [
"function",
"removeUnnecessaryCodeInNextToRange",
"(",
"range",
")",
"{",
"if",
"(",
"domUtils",
".",
"getNodeName",
"(",
"range",
".",
"startContainer",
".",
"nextSibling",
")",
"===",
"'CODE'",
"&&",
"domUtils",
".",
"getTextLength",
"(",
"range",
".",
"startC... | removeUnnecessaryCodeInNextToRange
Remove unnecessary code tag next to range, code tag made by squire
@param {Range} range range object | [
"removeUnnecessaryCodeInNextToRange",
"Remove",
"unnecessary",
"code",
"tag",
"next",
"to",
"range",
"code",
"tag",
"made",
"by",
"squire"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/code.js#L49-L55 |
1,332 | nhn/tui.editor | src/js/wysiwygCommands/code.js | styleCode | function styleCode(editor, sq) {
if (!sq.hasFormat('PRE') && sq.hasFormat('code')) {
sq.changeFormat(null, {tag: 'code'});
removeUnnecessaryCodeInNextToRange(editor.getSelection().cloneRange());
} else if (!sq.hasFormat('a') && !sq.hasFormat('PRE')) {
if (sq.hasFormat('b')) {
sq.removeBold();
... | javascript | function styleCode(editor, sq) {
if (!sq.hasFormat('PRE') && sq.hasFormat('code')) {
sq.changeFormat(null, {tag: 'code'});
removeUnnecessaryCodeInNextToRange(editor.getSelection().cloneRange());
} else if (!sq.hasFormat('a') && !sq.hasFormat('PRE')) {
if (sq.hasFormat('b')) {
sq.removeBold();
... | [
"function",
"styleCode",
"(",
"editor",
",",
"sq",
")",
"{",
"if",
"(",
"!",
"sq",
".",
"hasFormat",
"(",
"'PRE'",
")",
"&&",
"sq",
".",
"hasFormat",
"(",
"'code'",
")",
")",
"{",
"sq",
".",
"changeFormat",
"(",
"null",
",",
"{",
"tag",
":",
"'co... | Style code.
@param {object} editor - editor instance
@param {object} sq - squire editor instance | [
"Style",
"code",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/code.js#L62-L81 |
1,333 | nhn/tui.editor | src/js/wwCodeBlockManager.js | sanitizeHtmlCode | function sanitizeHtmlCode(code) {
return code ? code.replace(/[<>&]/g, tag => tagEntities[tag] || tag) : '';
} | javascript | function sanitizeHtmlCode(code) {
return code ? code.replace(/[<>&]/g, tag => tagEntities[tag] || tag) : '';
} | [
"function",
"sanitizeHtmlCode",
"(",
"code",
")",
"{",
"return",
"code",
"?",
"code",
".",
"replace",
"(",
"/",
"[<>&]",
"/",
"g",
",",
"tag",
"=>",
"tagEntities",
"[",
"tag",
"]",
"||",
"tag",
")",
":",
"''",
";",
"}"
] | Sanitize HTML code
@param {string} code code string
@returns {string}
@ignore | [
"Sanitize",
"HTML",
"code"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wwCodeBlockManager.js#L388-L390 |
1,334 | nhn/tui.editor | src/js/extensions/table/tableRenderer.js | _createCellHtml | function _createCellHtml(cell) {
let attrs = cell.colspan > 1 ? ` colspan="${cell.colspan}"` : '';
attrs += cell.rowspan > 1 ? ` rowspan="${cell.rowspan}"` : '';
attrs += cell.align ? ` align="${cell.align}"` : '';
return `<${cell.nodeName}${attrs}>${cell.content}</${cell.nodeName}>`;
} | javascript | function _createCellHtml(cell) {
let attrs = cell.colspan > 1 ? ` colspan="${cell.colspan}"` : '';
attrs += cell.rowspan > 1 ? ` rowspan="${cell.rowspan}"` : '';
attrs += cell.align ? ` align="${cell.align}"` : '';
return `<${cell.nodeName}${attrs}>${cell.content}</${cell.nodeName}>`;
} | [
"function",
"_createCellHtml",
"(",
"cell",
")",
"{",
"let",
"attrs",
"=",
"cell",
".",
"colspan",
">",
"1",
"?",
"`",
"${",
"cell",
".",
"colspan",
"}",
"`",
":",
"''",
";",
"attrs",
"+=",
"cell",
".",
"rowspan",
">",
"1",
"?",
"`",
"${",
"cell"... | Create cell html.
@param {object} cell - cell data of table base data
@returns {string}
@private | [
"Create",
"cell",
"html",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/tableRenderer.js#L15-L21 |
1,335 | nhn/tui.editor | src/js/extensions/table/tableRenderer.js | _createTheadOrTbodyHtml | function _createTheadOrTbodyHtml(trs, wrapperNodeName) {
let html = '';
if (trs.length) {
html = trs.map(tr => {
const tdHtml = tr.map(_createCellHtml).join('');
return `<tr>${tdHtml}</tr>`;
}).join('');
html = `<${wrapperNodeName}>${html}</${wrapperNodeName}>`;
}
return html;
} | javascript | function _createTheadOrTbodyHtml(trs, wrapperNodeName) {
let html = '';
if (trs.length) {
html = trs.map(tr => {
const tdHtml = tr.map(_createCellHtml).join('');
return `<tr>${tdHtml}</tr>`;
}).join('');
html = `<${wrapperNodeName}>${html}</${wrapperNodeName}>`;
}
return html;
} | [
"function",
"_createTheadOrTbodyHtml",
"(",
"trs",
",",
"wrapperNodeName",
")",
"{",
"let",
"html",
"=",
"''",
";",
"if",
"(",
"trs",
".",
"length",
")",
"{",
"html",
"=",
"trs",
".",
"map",
"(",
"tr",
"=>",
"{",
"const",
"tdHtml",
"=",
"tr",
".",
... | Create html for thead or tbody.
@param {Array.<Array.<object>>} trs - tr list
@param {string} wrapperNodeName - wrapper node name like THEAD, TBODY
@returns {string}
@private | [
"Create",
"html",
"for",
"thead",
"or",
"tbody",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/tableRenderer.js#L30-L43 |
1,336 | nhn/tui.editor | src/js/extensions/table/tableRenderer.js | createTableHtml | function createTableHtml(renderData) {
const thead = [renderData[0]];
const tbody = renderData.slice(1);
const theadHtml = _createTheadOrTbodyHtml(thead, 'THEAD');
const tbodyHtml = _createTheadOrTbodyHtml(tbody, 'TBODY');
const className = renderData.className ? ` class="${renderData.className}"` : '';
re... | javascript | function createTableHtml(renderData) {
const thead = [renderData[0]];
const tbody = renderData.slice(1);
const theadHtml = _createTheadOrTbodyHtml(thead, 'THEAD');
const tbodyHtml = _createTheadOrTbodyHtml(tbody, 'TBODY');
const className = renderData.className ? ` class="${renderData.className}"` : '';
re... | [
"function",
"createTableHtml",
"(",
"renderData",
")",
"{",
"const",
"thead",
"=",
"[",
"renderData",
"[",
"0",
"]",
"]",
";",
"const",
"tbody",
"=",
"renderData",
".",
"slice",
"(",
"1",
")",
";",
"const",
"theadHtml",
"=",
"_createTheadOrTbodyHtml",
"(",... | Create table html.
@param {Array.<Array.<object>>} renderData - table data for render
@returns {string}
@private | [
"Create",
"table",
"html",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/tableRenderer.js#L51-L59 |
1,337 | nhn/tui.editor | src/js/extensions/table/tableRenderer.js | replaceTable | function replaceTable($table, tableData) {
const cellIndexData = tableDataHandler.createCellIndexData(tableData);
const renderData = tableDataHandler.createRenderData(tableData, cellIndexData);
const $newTable = $(createTableHtml(renderData));
$table.replaceWith($newTable);
return $newTable;
} | javascript | function replaceTable($table, tableData) {
const cellIndexData = tableDataHandler.createCellIndexData(tableData);
const renderData = tableDataHandler.createRenderData(tableData, cellIndexData);
const $newTable = $(createTableHtml(renderData));
$table.replaceWith($newTable);
return $newTable;
} | [
"function",
"replaceTable",
"(",
"$table",
",",
"tableData",
")",
"{",
"const",
"cellIndexData",
"=",
"tableDataHandler",
".",
"createCellIndexData",
"(",
"tableData",
")",
";",
"const",
"renderData",
"=",
"tableDataHandler",
".",
"createRenderData",
"(",
"tableData... | Replace table.
@param {jQuery} $table - table jQuery element
@param {Array.<Array.<object>>} tableData - table data
@returns {jQuery}
@ignore | [
"Replace",
"table",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/tableRenderer.js#L68-L76 |
1,338 | nhn/tui.editor | src/js/extensions/table/tableRenderer.js | focusToCell | function focusToCell(sq, range, targetCell) {
range.selectNodeContents(targetCell);
range.collapse(true);
sq.setSelection(range);
} | javascript | function focusToCell(sq, range, targetCell) {
range.selectNodeContents(targetCell);
range.collapse(true);
sq.setSelection(range);
} | [
"function",
"focusToCell",
"(",
"sq",
",",
"range",
",",
"targetCell",
")",
"{",
"range",
".",
"selectNodeContents",
"(",
"targetCell",
")",
";",
"range",
".",
"collapse",
"(",
"true",
")",
";",
"sq",
".",
"setSelection",
"(",
"range",
")",
";",
"}"
] | Focus to cell.
@param {squireext} sq - squire instance
@param {range} range - range object
@param {HTMLElement} targetCell - cell element for focus
@ignore | [
"Focus",
"to",
"cell",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/tableRenderer.js#L85-L89 |
1,339 | nhn/tui.editor | src/js/extensions/table/unmergeCell.js | _updateMergedCells | function _updateMergedCells(tableData, startRowIndex, startColIndex, rowspan, colspan) {
const limitRowIndex = startRowIndex + rowspan;
const limitColIndex = startColIndex + colspan;
const colRange = util.range(startColIndex, limitColIndex);
util.range(startRowIndex, limitRowIndex).forEach(rowIndex => {
co... | javascript | function _updateMergedCells(tableData, startRowIndex, startColIndex, rowspan, colspan) {
const limitRowIndex = startRowIndex + rowspan;
const limitColIndex = startColIndex + colspan;
const colRange = util.range(startColIndex, limitColIndex);
util.range(startRowIndex, limitRowIndex).forEach(rowIndex => {
co... | [
"function",
"_updateMergedCells",
"(",
"tableData",
",",
"startRowIndex",
",",
"startColIndex",
",",
"rowspan",
",",
"colspan",
")",
"{",
"const",
"limitRowIndex",
"=",
"startRowIndex",
"+",
"rowspan",
";",
"const",
"limitColIndex",
"=",
"startColIndex",
"+",
"col... | Update merged cell data to basic cell data.
@param {Array.<Array.<object>>} tableData - table data
@param {number} startRowIndex - start row index
@param {number} startColIndex - start col index
@param {number} rowspan - rowspan property of merger cell
@param {number} colspan - colspan property of merger cell
@private | [
"Update",
"merged",
"cell",
"data",
"to",
"basic",
"cell",
"data",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/unmergeCell.js#L79-L92 |
1,340 | nhn/tui.editor | src/js/extensions/table/mergedTableRemoveCol.js | _updateColspan | function _updateColspan(tableData, startColIndex, endColIndex) {
tableData.forEach(rowData => {
util.range(startColIndex, endColIndex + 1).forEach(colIndex => {
const cellData = rowData [colIndex];
if (util.isExisty(cellData.colMergeWith)) {
const merger = rowData [cellData.colMergeWith];
... | javascript | function _updateColspan(tableData, startColIndex, endColIndex) {
tableData.forEach(rowData => {
util.range(startColIndex, endColIndex + 1).forEach(colIndex => {
const cellData = rowData [colIndex];
if (util.isExisty(cellData.colMergeWith)) {
const merger = rowData [cellData.colMergeWith];
... | [
"function",
"_updateColspan",
"(",
"tableData",
",",
"startColIndex",
",",
"endColIndex",
")",
"{",
"tableData",
".",
"forEach",
"(",
"rowData",
"=>",
"{",
"util",
".",
"range",
"(",
"startColIndex",
",",
"endColIndex",
"+",
"1",
")",
".",
"forEach",
"(",
... | Update colspan to col merger.
@param {Array.<Array.<object>>} tableData - table data
@param {number} startColIndex - start col index
@param {number} endColIndex - end col index
@private | [
"Update",
"colspan",
"to",
"col",
"merger",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/mergedTableRemoveCol.js#L64-L86 |
1,341 | nhn/tui.editor | src/js/extensions/mark/viewerMarkerHelper.js | getRange | function getRange() {
const selection = window.getSelection();
let range;
if (selection && selection.rangeCount) {
range = selection.getRangeAt(0).cloneRange();
} else {
range = document.createRange();
range.selectNodeContents(this.preview.$el[0]);
range.collapse(true);
}
return range;
} | javascript | function getRange() {
const selection = window.getSelection();
let range;
if (selection && selection.rangeCount) {
range = selection.getRangeAt(0).cloneRange();
} else {
range = document.createRange();
range.selectNodeContents(this.preview.$el[0]);
range.collapse(true);
}
return range;
} | [
"function",
"getRange",
"(",
")",
"{",
"const",
"selection",
"=",
"window",
".",
"getSelection",
"(",
")",
";",
"let",
"range",
";",
"if",
"(",
"selection",
"&&",
"selection",
".",
"rangeCount",
")",
"{",
"range",
"=",
"selection",
".",
"getRangeAt",
"("... | getRange
get current range
@returns {Range}
@ignore | [
"getRange",
"get",
"current",
"range"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/mark/viewerMarkerHelper.js#L207-L220 |
1,342 | nhn/tui.editor | src/js/markdownItPlugins/markdownitTaskPlugin.js | removeMarkdownTaskFormatText | function removeMarkdownTaskFormatText(token) {
// '[X] ' length is 4
// FIXED: we don't need first space
token.content = token.content.slice(4);
token.children[0].content = token.children[0].content.slice(4);
} | javascript | function removeMarkdownTaskFormatText(token) {
// '[X] ' length is 4
// FIXED: we don't need first space
token.content = token.content.slice(4);
token.children[0].content = token.children[0].content.slice(4);
} | [
"function",
"removeMarkdownTaskFormatText",
"(",
"token",
")",
"{",
"// '[X] ' length is 4",
"// FIXED: we don't need first space",
"token",
".",
"content",
"=",
"token",
".",
"content",
".",
"slice",
"(",
"4",
")",
";",
"token",
".",
"children",
"[",
"0",
"]",
... | Remove task format text for rendering
@param {object} token Token object
@ignore | [
"Remove",
"task",
"format",
"text",
"for",
"rendering"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/markdownItPlugins/markdownitTaskPlugin.js#L47-L52 |
1,343 | nhn/tui.editor | src/js/markdownItPlugins/markdownitTaskPlugin.js | isChecked | function isChecked(token) {
var checked = false;
if (token.content.indexOf('[x]') === 0 || token.content.indexOf('[X]') === 0) {
checked = true;
}
return checked;
} | javascript | function isChecked(token) {
var checked = false;
if (token.content.indexOf('[x]') === 0 || token.content.indexOf('[X]') === 0) {
checked = true;
}
return checked;
} | [
"function",
"isChecked",
"(",
"token",
")",
"{",
"var",
"checked",
"=",
"false",
";",
"if",
"(",
"token",
".",
"content",
".",
"indexOf",
"(",
"'[x]'",
")",
"===",
"0",
"||",
"token",
".",
"content",
".",
"indexOf",
"(",
"'[X]'",
")",
"===",
"0",
"... | Return boolean value whether task checked or not
@param {object} token Token object
@returns {boolean}
@ignore | [
"Return",
"boolean",
"value",
"whether",
"task",
"checked",
"or",
"not"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/markdownItPlugins/markdownitTaskPlugin.js#L60-L68 |
1,344 | nhn/tui.editor | src/js/markdownItPlugins/markdownitTaskPlugin.js | setTokenAttribute | function setTokenAttribute(token, attributeName, attributeValue) {
var index = token.attrIndex(attributeName);
var attr = [attributeName, attributeValue];
if (index < 0) {
token.attrPush(attr);
} else {
token.attrs[index] = attr;
}
} | javascript | function setTokenAttribute(token, attributeName, attributeValue) {
var index = token.attrIndex(attributeName);
var attr = [attributeName, attributeValue];
if (index < 0) {
token.attrPush(attr);
} else {
token.attrs[index] = attr;
}
} | [
"function",
"setTokenAttribute",
"(",
"token",
",",
"attributeName",
",",
"attributeValue",
")",
"{",
"var",
"index",
"=",
"token",
".",
"attrIndex",
"(",
"attributeName",
")",
";",
"var",
"attr",
"=",
"[",
"attributeName",
",",
"attributeValue",
"]",
";",
"... | Set attribute of passed token
@param {object} token Token object
@param {string} attributeName Attribute name for set
@param {string} attributeValue Attribute value for set
@ignore | [
"Set",
"attribute",
"of",
"passed",
"token"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/markdownItPlugins/markdownitTaskPlugin.js#L77-L86 |
1,345 | nhn/tui.editor | src/js/markdownItPlugins/markdownitTaskPlugin.js | isTaskListItemToken | function isTaskListItemToken(tokens, index) {
return tokens[index].type === 'inline'
&& tokens[index - 1].type === 'paragraph_open'
&& tokens[index - 2].type === 'list_item_open'
&& (tokens[index].content.indexOf('[ ]') === 0
|| tokens[index].content.indexOf('[x]') === 0
... | javascript | function isTaskListItemToken(tokens, index) {
return tokens[index].type === 'inline'
&& tokens[index - 1].type === 'paragraph_open'
&& tokens[index - 2].type === 'list_item_open'
&& (tokens[index].content.indexOf('[ ]') === 0
|| tokens[index].content.indexOf('[x]') === 0
... | [
"function",
"isTaskListItemToken",
"(",
"tokens",
",",
"index",
")",
"{",
"return",
"tokens",
"[",
"index",
"]",
".",
"type",
"===",
"'inline'",
"&&",
"tokens",
"[",
"index",
"-",
"1",
"]",
".",
"type",
"===",
"'paragraph_open'",
"&&",
"tokens",
"[",
"in... | Return boolean value whether task list item or not
@param {array} tokens Token object
@param {number} index Number of token index
@returns {boolean}
@ignore | [
"Return",
"boolean",
"value",
"whether",
"task",
"list",
"item",
"or",
"not"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/markdownItPlugins/markdownitTaskPlugin.js#L95-L102 |
1,346 | nhn/tui.editor | src/js/wysiwygCommands/tableRemoveCol.js | getCellByRange | function getCellByRange(range) {
let cell = range.startContainer;
if (domUtils.getNodeName(cell) === 'TD' || domUtils.getNodeName(cell) === 'TH') {
cell = $(cell);
} else {
cell = $(cell).parentsUntil('tr');
}
return cell;
} | javascript | function getCellByRange(range) {
let cell = range.startContainer;
if (domUtils.getNodeName(cell) === 'TD' || domUtils.getNodeName(cell) === 'TH') {
cell = $(cell);
} else {
cell = $(cell).parentsUntil('tr');
}
return cell;
} | [
"function",
"getCellByRange",
"(",
"range",
")",
"{",
"let",
"cell",
"=",
"range",
".",
"startContainer",
";",
"if",
"(",
"domUtils",
".",
"getNodeName",
"(",
"cell",
")",
"===",
"'TD'",
"||",
"domUtils",
".",
"getNodeName",
"(",
"cell",
")",
"===",
"'TH... | Get cell by range object
@param {Range} range range
@returns {HTMLElement|Node} | [
"Get",
"cell",
"by",
"range",
"object"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/tableRemoveCol.js#L68-L78 |
1,347 | nhn/tui.editor | src/js/wysiwygCommands/tableRemoveCol.js | removeMultipleColsByCells | function removeMultipleColsByCells($cells) {
const numberOfCells = $cells.length;
for (let i = 0; i < numberOfCells; i += 1) {
const $cellToDelete = $cells.eq(i);
if ($cellToDelete.length > 0) {
removeColByCell($cells.eq(i));
}
}
} | javascript | function removeMultipleColsByCells($cells) {
const numberOfCells = $cells.length;
for (let i = 0; i < numberOfCells; i += 1) {
const $cellToDelete = $cells.eq(i);
if ($cellToDelete.length > 0) {
removeColByCell($cells.eq(i));
}
}
} | [
"function",
"removeMultipleColsByCells",
"(",
"$cells",
")",
"{",
"const",
"numberOfCells",
"=",
"$cells",
".",
"length",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"numberOfCells",
";",
"i",
"+=",
"1",
")",
"{",
"const",
"$cellToDelete",
"=",... | Remove columns by given cells
@param {jQuery} $cells - jQuery table cells | [
"Remove",
"columns",
"by",
"given",
"cells"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/tableRemoveCol.js#L84-L92 |
1,348 | nhn/tui.editor | src/js/wysiwygCommands/tableRemoveCol.js | removeColByCell | function removeColByCell($cell) {
const index = $cell.index();
$cell.parents('table').find('tr').each((n, tr) => {
$(tr).children().eq(index).remove();
});
} | javascript | function removeColByCell($cell) {
const index = $cell.index();
$cell.parents('table').find('tr').each((n, tr) => {
$(tr).children().eq(index).remove();
});
} | [
"function",
"removeColByCell",
"(",
"$cell",
")",
"{",
"const",
"index",
"=",
"$cell",
".",
"index",
"(",
")",
";",
"$cell",
".",
"parents",
"(",
"'table'",
")",
".",
"find",
"(",
"'tr'",
")",
".",
"each",
"(",
"(",
"n",
",",
"tr",
")",
"=>",
"{"... | Remove column by given cell
@param {jQuery} $cell - jQuery wrapped table cell | [
"Remove",
"column",
"by",
"given",
"cell"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/tableRemoveCol.js#L98-L104 |
1,349 | nhn/tui.editor | src/js/wysiwygCommands/tableRemoveCol.js | focusToCell | function focusToCell(sq, $cell, tableMgr) {
const nextFocusCell = $cell.get(0);
if ($cell.length && $.contains(document, $cell)) {
const range = sq.getSelection();
range.selectNodeContents($cell[0]);
range.collapse(true);
sq.setSelection(range);
tableMgr.setLastCellNode(nextFocusCell);
}
} | javascript | function focusToCell(sq, $cell, tableMgr) {
const nextFocusCell = $cell.get(0);
if ($cell.length && $.contains(document, $cell)) {
const range = sq.getSelection();
range.selectNodeContents($cell[0]);
range.collapse(true);
sq.setSelection(range);
tableMgr.setLastCellNode(nextFocusCell);
}
} | [
"function",
"focusToCell",
"(",
"sq",
",",
"$cell",
",",
"tableMgr",
")",
"{",
"const",
"nextFocusCell",
"=",
"$cell",
".",
"get",
"(",
"0",
")",
";",
"if",
"(",
"$cell",
".",
"length",
"&&",
"$",
".",
"contains",
"(",
"document",
",",
"$cell",
")",
... | Focus to given cell
@param {Squire} sq - Squire instance
@param {jQuery} $cell - jQuery wrapped table cell
@param {object} tableMgr - Table manager instance | [
"Focus",
"to",
"given",
"cell"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/tableRemoveCol.js#L112-L123 |
1,350 | nhn/tui.editor | src/js/wysiwygCommands/bold.js | styleBold | function styleBold(sq) {
if (sq.hasFormat('b') || sq.hasFormat('strong')) {
sq.changeFormat(null, {tag: 'b'});
} else if (!sq.hasFormat('a') && !sq.hasFormat('PRE')) {
if (sq.hasFormat('code')) {
sq.changeFormat(null, {tag: 'code'});
}
sq.bold();
}
} | javascript | function styleBold(sq) {
if (sq.hasFormat('b') || sq.hasFormat('strong')) {
sq.changeFormat(null, {tag: 'b'});
} else if (!sq.hasFormat('a') && !sq.hasFormat('PRE')) {
if (sq.hasFormat('code')) {
sq.changeFormat(null, {tag: 'code'});
}
sq.bold();
}
} | [
"function",
"styleBold",
"(",
"sq",
")",
"{",
"if",
"(",
"sq",
".",
"hasFormat",
"(",
"'b'",
")",
"||",
"sq",
".",
"hasFormat",
"(",
"'strong'",
")",
")",
"{",
"sq",
".",
"changeFormat",
"(",
"null",
",",
"{",
"tag",
":",
"'b'",
"}",
")",
";",
... | Style bold.
@param {object} sq - squire editor instance | [
"Style",
"bold",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/bold.js#L43-L52 |
1,351 | nhn/tui.editor | src/js/extensions/table/wwMergedTableManager.js | any | function any(arr, contition) {
let result = false;
util.forEach(arr, item => {
result = contition(item);
return !result;
});
return result;
} | javascript | function any(arr, contition) {
let result = false;
util.forEach(arr, item => {
result = contition(item);
return !result;
});
return result;
} | [
"function",
"any",
"(",
"arr",
",",
"contition",
")",
"{",
"let",
"result",
"=",
"false",
";",
"util",
".",
"forEach",
"(",
"arr",
",",
"item",
"=>",
"{",
"result",
"=",
"contition",
"(",
"item",
")",
";",
"return",
"!",
"result",
";",
"}",
")",
... | Whether one of them is true or not.
@param {Array} arr - target array
@param {function} contition - condition function
@returns {boolean}
@ignore | [
"Whether",
"one",
"of",
"them",
"is",
"true",
"or",
"not",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/wwMergedTableManager.js#L543-L553 |
1,352 | nhn/tui.editor | src/js/wysiwygCommands/tableAddCol.js | getNumberOfCols | function getNumberOfCols(wwe) {
const selectionMgr = wwe.componentManager.getManager('tableSelection');
const $selectedCells = selectionMgr.getSelectedCells();
let length = 1;
if ($selectedCells.length > 0) {
const maxLength = $selectedCells.get(0).parentNode.querySelectorAll('td, th').length;
length =... | javascript | function getNumberOfCols(wwe) {
const selectionMgr = wwe.componentManager.getManager('tableSelection');
const $selectedCells = selectionMgr.getSelectedCells();
let length = 1;
if ($selectedCells.length > 0) {
const maxLength = $selectedCells.get(0).parentNode.querySelectorAll('td, th').length;
length =... | [
"function",
"getNumberOfCols",
"(",
"wwe",
")",
"{",
"const",
"selectionMgr",
"=",
"wwe",
".",
"componentManager",
".",
"getManager",
"(",
"'tableSelection'",
")",
";",
"const",
"$selectedCells",
"=",
"selectionMgr",
".",
"getSelectedCells",
"(",
")",
";",
"let"... | get number of selected cols
@param {WysiwygEditor} wwe - wysiwyg editor instance
@returns {number} - number of selected cols
@ignore | [
"get",
"number",
"of",
"selected",
"cols"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/tableAddCol.js#L49-L60 |
1,353 | nhn/tui.editor | src/js/wysiwygCommands/tableAddCol.js | addColToCellAfter | function addColToCellAfter($cell, numberOfCols = 1) {
const index = $cell.index();
let cellToAdd;
$cell.parents('table').find('tr').each((n, tr) => {
const isTBody = domUtils.getNodeName(tr.parentNode) === 'TBODY';
const isMSIE = util.browser.msie;
const cell = tr.children[index];
for (let i = 0;... | javascript | function addColToCellAfter($cell, numberOfCols = 1) {
const index = $cell.index();
let cellToAdd;
$cell.parents('table').find('tr').each((n, tr) => {
const isTBody = domUtils.getNodeName(tr.parentNode) === 'TBODY';
const isMSIE = util.browser.msie;
const cell = tr.children[index];
for (let i = 0;... | [
"function",
"addColToCellAfter",
"(",
"$cell",
",",
"numberOfCols",
"=",
"1",
")",
"{",
"const",
"index",
"=",
"$cell",
".",
"index",
"(",
")",
";",
"let",
"cellToAdd",
";",
"$cell",
".",
"parents",
"(",
"'table'",
")",
".",
"find",
"(",
"'tr'",
")",
... | Add column to after the current cell
@param {jQuery} $cell - jQuery wrapped table cell
@param {number} [numberOfCols=1] - number of cols
@ignore | [
"Add",
"column",
"to",
"after",
"the",
"current",
"cell"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/tableAddCol.js#L86-L106 |
1,354 | nhn/tui.editor | src/js/wysiwygCommands/tableAddCol.js | focusToNextCell | function focusToNextCell(sq, $cell) {
const range = sq.getSelection();
range.selectNodeContents($cell.next()[0]);
range.collapse(true);
sq.setSelection(range);
} | javascript | function focusToNextCell(sq, $cell) {
const range = sq.getSelection();
range.selectNodeContents($cell.next()[0]);
range.collapse(true);
sq.setSelection(range);
} | [
"function",
"focusToNextCell",
"(",
"sq",
",",
"$cell",
")",
"{",
"const",
"range",
"=",
"sq",
".",
"getSelection",
"(",
")",
";",
"range",
".",
"selectNodeContents",
"(",
"$cell",
".",
"next",
"(",
")",
"[",
"0",
"]",
")",
";",
"range",
".",
"collap... | Focus to next cell
@param {Squire} sq - Squire instance
@param {jQuery} $cell - jQuery wrapped table cell
@ignore | [
"Focus",
"to",
"next",
"cell"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/tableAddCol.js#L114-L121 |
1,355 | nhn/tui.editor | src/js/extensions/uml.js | umlExtension | function umlExtension(editor, options = {}) {
const {
rendererURL = DEFAULT_RENDERER_URL
} = options;
/**
* render html from uml
* @param {string} umlCode - plant uml code text
* @returns {string} - rendered html
*/
function plantUMLReplacer(umlCode) {
let renderedHTML;
try {
if ... | javascript | function umlExtension(editor, options = {}) {
const {
rendererURL = DEFAULT_RENDERER_URL
} = options;
/**
* render html from uml
* @param {string} umlCode - plant uml code text
* @returns {string} - rendered html
*/
function plantUMLReplacer(umlCode) {
let renderedHTML;
try {
if ... | [
"function",
"umlExtension",
"(",
"editor",
",",
"options",
"=",
"{",
"}",
")",
"{",
"const",
"{",
"rendererURL",
"=",
"DEFAULT_RENDERER_URL",
"}",
"=",
"options",
";",
"/**\n * render html from uml\n * @param {string} umlCode - plant uml code text\n * @returns {string} ... | plant uml plugin
@param {Editor} editor - editor
@param {object} [options={}] - plugin options
@param {string} options.rendererURL - plant uml renderer url
@ignore | [
"plant",
"uml",
"plugin"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/uml.js#L20-L52 |
1,356 | nhn/tui.editor | src/js/extensions/uml.js | plantUMLReplacer | function plantUMLReplacer(umlCode) {
let renderedHTML;
try {
if (!plantumlEncoder) {
throw new Error('plantuml-encoder dependency required');
}
renderedHTML = `<img src="${rendererURL}${plantumlEncoder.encode(umlCode)}" />`;
} catch (err) {
renderedHTML = `Error occurred on ... | javascript | function plantUMLReplacer(umlCode) {
let renderedHTML;
try {
if (!plantumlEncoder) {
throw new Error('plantuml-encoder dependency required');
}
renderedHTML = `<img src="${rendererURL}${plantumlEncoder.encode(umlCode)}" />`;
} catch (err) {
renderedHTML = `Error occurred on ... | [
"function",
"plantUMLReplacer",
"(",
"umlCode",
")",
"{",
"let",
"renderedHTML",
";",
"try",
"{",
"if",
"(",
"!",
"plantumlEncoder",
")",
"{",
"throw",
"new",
"Error",
"(",
"'plantuml-encoder dependency required'",
")",
";",
"}",
"renderedHTML",
"=",
"`",
"${"... | render html from uml
@param {string} umlCode - plant uml code text
@returns {string} - rendered html | [
"render",
"html",
"from",
"uml"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/uml.js#L30-L43 |
1,357 | nhn/tui.editor | src/js/extensions/table/mergedTableUI.js | _changeContent | function _changeContent(popupTableUtils) {
const POPUP_CONTENT = [
`<button type="button" class="te-table-add-row">${i18n.get('Add row')}</button>`,
`<button type="button" class="te-table-add-col">${i18n.get('Add col')}</button>`,
`<button type="button" class="te-table-remove-row">${i18n.get('Remove row')... | javascript | function _changeContent(popupTableUtils) {
const POPUP_CONTENT = [
`<button type="button" class="te-table-add-row">${i18n.get('Add row')}</button>`,
`<button type="button" class="te-table-add-col">${i18n.get('Add col')}</button>`,
`<button type="button" class="te-table-remove-row">${i18n.get('Remove row')... | [
"function",
"_changeContent",
"(",
"popupTableUtils",
")",
"{",
"const",
"POPUP_CONTENT",
"=",
"[",
"`",
"${",
"i18n",
".",
"get",
"(",
"'Add row'",
")",
"}",
"`",
",",
"`",
"${",
"i18n",
".",
"get",
"(",
"'Add col'",
")",
"}",
"`",
",",
"`",
"${",
... | Change contextmenu content.
@param {object} popupTableUtils - PopupTableUtils instance for managing contextmenu of table
@private | [
"Change",
"contextmenu",
"content",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/mergedTableUI.js#L15-L34 |
1,358 | nhn/tui.editor | src/js/extensions/table/mergedTableUI.js | _bindEvents | function _bindEvents(popupTableUtils, eventManager, selectionManager) {
const $popupContent = popupTableUtils.$content;
const $mergeBtn = $($popupContent[5]);
const $unmergeBtn = $($popupContent[6]);
const $separator = $($popupContent[7]);
popupTableUtils.on('click .te-table-merge', () => {
eventManager.... | javascript | function _bindEvents(popupTableUtils, eventManager, selectionManager) {
const $popupContent = popupTableUtils.$content;
const $mergeBtn = $($popupContent[5]);
const $unmergeBtn = $($popupContent[6]);
const $separator = $($popupContent[7]);
popupTableUtils.on('click .te-table-merge', () => {
eventManager.... | [
"function",
"_bindEvents",
"(",
"popupTableUtils",
",",
"eventManager",
",",
"selectionManager",
")",
"{",
"const",
"$popupContent",
"=",
"popupTableUtils",
".",
"$content",
";",
"const",
"$mergeBtn",
"=",
"$",
"(",
"$popupContent",
"[",
"5",
"]",
")",
";",
"c... | Bind events for merge feature of contextmenu.
@param {object} popupTableUtils - PopupTableUtils instance for managing contextmenu of table
@param {object} eventManager - event manager instance of editor
@param {object} selectionManager - table selection manager instance
@private | [
"Bind",
"events",
"for",
"merge",
"feature",
"of",
"contextmenu",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/mergedTableUI.js#L43-L80 |
1,359 | nhn/tui.editor | src/js/extensions/table/mergedTableUI.js | updateContextMenu | function updateContextMenu(popupTableUtils, eventManager, selectionManager) {
_changeContent(popupTableUtils);
_bindEvents(popupTableUtils, eventManager, selectionManager);
} | javascript | function updateContextMenu(popupTableUtils, eventManager, selectionManager) {
_changeContent(popupTableUtils);
_bindEvents(popupTableUtils, eventManager, selectionManager);
} | [
"function",
"updateContextMenu",
"(",
"popupTableUtils",
",",
"eventManager",
",",
"selectionManager",
")",
"{",
"_changeContent",
"(",
"popupTableUtils",
")",
";",
"_bindEvents",
"(",
"popupTableUtils",
",",
"eventManager",
",",
"selectionManager",
")",
";",
"}"
] | Update contextmenu UI.
@param {object} popupTableUtils - PopupTableUtils instance for managing contextmenu of table
@param {object} eventManager - event manager instance of editor
@param {object} selectionManager - table selection manager instance
@ignore | [
"Update",
"contextmenu",
"UI",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/mergedTableUI.js#L89-L92 |
1,360 | nhn/tui.editor | src/js/extensions/table/mergedTableAlignCol.js | _align | function _align(headRowData, startColIndex, endColIndex, alignDirection) {
util.range(startColIndex, endColIndex + 1).forEach(colIndex => {
const headCellData = headRowData[colIndex];
if (util.isExisty(headCellData.colMergeWith)) {
headRowData[headCellData.colMergeWith].align = alignDirection;
} el... | javascript | function _align(headRowData, startColIndex, endColIndex, alignDirection) {
util.range(startColIndex, endColIndex + 1).forEach(colIndex => {
const headCellData = headRowData[colIndex];
if (util.isExisty(headCellData.colMergeWith)) {
headRowData[headCellData.colMergeWith].align = alignDirection;
} el... | [
"function",
"_align",
"(",
"headRowData",
",",
"startColIndex",
",",
"endColIndex",
",",
"alignDirection",
")",
"{",
"util",
".",
"range",
"(",
"startColIndex",
",",
"endColIndex",
"+",
"1",
")",
".",
"forEach",
"(",
"colIndex",
"=>",
"{",
"const",
"headCell... | Align to table header.
@param {Array.<object>} headRowData - head row data
@param {number} startColIndex - start column index for styling align
@param {number} endColIndex - end column index for styling align
@param {string} alignDirection - align direction
@private | [
"Align",
"to",
"table",
"header",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/mergedTableAlignCol.js#L58-L68 |
1,361 | nhn/tui.editor | src/js/wysiwygCommands/codeBlock.js | focusToFirstCode | function focusToFirstCode($pre, wwe) {
const range = wwe.getEditor().getSelection().cloneRange();
$pre.removeClass(CODEBLOCK_CLASS_TEMP);
range.setStartBefore($pre.get(0).firstChild);
range.collapse(true);
wwe.getEditor().setSelection(range);
} | javascript | function focusToFirstCode($pre, wwe) {
const range = wwe.getEditor().getSelection().cloneRange();
$pre.removeClass(CODEBLOCK_CLASS_TEMP);
range.setStartBefore($pre.get(0).firstChild);
range.collapse(true);
wwe.getEditor().setSelection(range);
} | [
"function",
"focusToFirstCode",
"(",
"$pre",
",",
"wwe",
")",
"{",
"const",
"range",
"=",
"wwe",
".",
"getEditor",
"(",
")",
".",
"getSelection",
"(",
")",
".",
"cloneRange",
"(",
")",
";",
"$pre",
".",
"removeClass",
"(",
"CODEBLOCK_CLASS_TEMP",
")",
";... | focusToFirstCode
Focus to first code tag content of pre tag
@param {jQuery} $pre pre tag
@param {WysiwygEditor} wwe wysiwygEditor | [
"focusToFirstCode",
"Focus",
"to",
"first",
"code",
"tag",
"content",
"of",
"pre",
"tag"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/codeBlock.js#L54-L62 |
1,362 | nhn/tui.editor | src/js/wysiwygCommands/codeBlock.js | getCodeBlockBody | function getCodeBlockBody(range, wwe) {
const mgr = wwe.componentManager.getManager('codeblock');
let codeBlock;
if (range.collapsed) {
codeBlock = '<br>';
} else {
const contents = range.extractContents();
const nodes = util.toArray(contents.childNodes);
const tempDiv = $('<div>').append(mgr.pr... | javascript | function getCodeBlockBody(range, wwe) {
const mgr = wwe.componentManager.getManager('codeblock');
let codeBlock;
if (range.collapsed) {
codeBlock = '<br>';
} else {
const contents = range.extractContents();
const nodes = util.toArray(contents.childNodes);
const tempDiv = $('<div>').append(mgr.pr... | [
"function",
"getCodeBlockBody",
"(",
"range",
",",
"wwe",
")",
"{",
"const",
"mgr",
"=",
"wwe",
".",
"componentManager",
".",
"getManager",
"(",
"'codeblock'",
")",
";",
"let",
"codeBlock",
";",
"if",
"(",
"range",
".",
"collapsed",
")",
"{",
"codeBlock",
... | getCodeBlockBody
get text wrapped by code
@param {object} range range object
@param {object} wwe wysiwyg editor
@returns {string} | [
"getCodeBlockBody",
"get",
"text",
"wrapped",
"by",
"code"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/codeBlock.js#L70-L83 |
1,363 | nhn/tui.editor | src/js/wwTableManager.js | tableCellGenerator | function tableCellGenerator(amount, tagName) {
const brHTMLString = '<br />';
const cellString = `<${tagName}>${brHTMLString}</${tagName}>`;
let tdString = '';
for (let i = 0; i < amount; i += 1) {
tdString = tdString + cellString;
}
return tdString;
} | javascript | function tableCellGenerator(amount, tagName) {
const brHTMLString = '<br />';
const cellString = `<${tagName}>${brHTMLString}</${tagName}>`;
let tdString = '';
for (let i = 0; i < amount; i += 1) {
tdString = tdString + cellString;
}
return tdString;
} | [
"function",
"tableCellGenerator",
"(",
"amount",
",",
"tagName",
")",
"{",
"const",
"brHTMLString",
"=",
"'<br />'",
";",
"const",
"cellString",
"=",
"`",
"${",
"tagName",
"}",
"${",
"brHTMLString",
"}",
"${",
"tagName",
"}",
"`",
";",
"let",
"tdString",
"... | Generate table cell HTML text
@param {number} amount Amount of cells
@param {string} tagName Tag name of cell 'td' or 'th'
@private
@returns {string} | [
"Generate",
"table",
"cell",
"HTML",
"text"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wwTableManager.js#L1274-L1284 |
1,364 | nhn/tui.editor | src/js/extensions/table/mergedTableCreator.js | _findIndex | function _findIndex(arr, onFind) {
let foundIndex = -1;
util.forEach(arr, (item, index) => {
let nextFind = true;
if (onFind(item, index)) {
foundIndex = index;
nextFind = false;
}
return nextFind;
});
return foundIndex;
} | javascript | function _findIndex(arr, onFind) {
let foundIndex = -1;
util.forEach(arr, (item, index) => {
let nextFind = true;
if (onFind(item, index)) {
foundIndex = index;
nextFind = false;
}
return nextFind;
});
return foundIndex;
} | [
"function",
"_findIndex",
"(",
"arr",
",",
"onFind",
")",
"{",
"let",
"foundIndex",
"=",
"-",
"1",
";",
"util",
".",
"forEach",
"(",
"arr",
",",
"(",
"item",
",",
"index",
")",
"=>",
"{",
"let",
"nextFind",
"=",
"true",
";",
"if",
"(",
"onFind",
... | Find index by onFind function.
@param {Array} arr - target array
@param {function} onFind - find function
@returns {number}
@private | [
"Find",
"index",
"by",
"onFind",
"function",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/mergedTableCreator.js#L80-L94 |
1,365 | nhn/tui.editor | src/js/wysiwygCommands/table.js | focusToFirstTh | function focusToFirstTh(sq, $table) {
const range = sq.getSelection();
range.selectNodeContents($table.find('th')[0]);
range.collapse(true);
sq.setSelection(range);
} | javascript | function focusToFirstTh(sq, $table) {
const range = sq.getSelection();
range.selectNodeContents($table.find('th')[0]);
range.collapse(true);
sq.setSelection(range);
} | [
"function",
"focusToFirstTh",
"(",
"sq",
",",
"$table",
")",
"{",
"const",
"range",
"=",
"sq",
".",
"getSelection",
"(",
")",
";",
"range",
".",
"selectNodeContents",
"(",
"$table",
".",
"find",
"(",
"'th'",
")",
"[",
"0",
"]",
")",
";",
"range",
"."... | Focus to first th
@param {Squire} sq Squire instance
@param {jQuery} $table jQuery wrapped table element | [
"Focus",
"to",
"first",
"th"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/table.js#L54-L60 |
1,366 | nhn/tui.editor | src/js/wysiwygCommands/table.js | makeHeader | function makeHeader(col, data) {
let header = '<thead><tr>';
let index = 0;
while (col) {
header += '<th>';
if (data) {
header += data[index];
index += 1;
}
header += '</th>';
col -= 1;
}
header += '</tr></thead>';
return header;
} | javascript | function makeHeader(col, data) {
let header = '<thead><tr>';
let index = 0;
while (col) {
header += '<th>';
if (data) {
header += data[index];
index += 1;
}
header += '</th>';
col -= 1;
}
header += '</tr></thead>';
return header;
} | [
"function",
"makeHeader",
"(",
"col",
",",
"data",
")",
"{",
"let",
"header",
"=",
"'<thead><tr>'",
";",
"let",
"index",
"=",
"0",
";",
"while",
"(",
"col",
")",
"{",
"header",
"+=",
"'<th>'",
";",
"if",
"(",
"data",
")",
"{",
"header",
"+=",
"data... | makeHeader
make table header html string
@param {number} col column count
@param {string} data cell data
@returns {string} html string | [
"makeHeader",
"make",
"table",
"header",
"html",
"string"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/table.js#L69-L88 |
1,367 | nhn/tui.editor | src/js/wysiwygCommands/table.js | makeBody | function makeBody(col, row, data) {
let body = '<tbody>';
let index = col;
for (let irow = 0; irow < row; irow += 1) {
body += '<tr>';
for (let icol = 0; icol < col; icol += 1) {
body += '<td>';
if (data) {
body += data[index];
index += 1;
}
body += '</td>';
... | javascript | function makeBody(col, row, data) {
let body = '<tbody>';
let index = col;
for (let irow = 0; irow < row; irow += 1) {
body += '<tr>';
for (let icol = 0; icol < col; icol += 1) {
body += '<td>';
if (data) {
body += data[index];
index += 1;
}
body += '</td>';
... | [
"function",
"makeBody",
"(",
"col",
",",
"row",
",",
"data",
")",
"{",
"let",
"body",
"=",
"'<tbody>'",
";",
"let",
"index",
"=",
"col",
";",
"for",
"(",
"let",
"irow",
"=",
"0",
";",
"irow",
"<",
"row",
";",
"irow",
"+=",
"1",
")",
"{",
"body"... | makeBody
make table body html string
@param {number} col column count
@param {number} row row count
@param {string} data cell data
@returns {string} html string | [
"makeBody",
"make",
"table",
"body",
"html",
"string"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/table.js#L98-L122 |
1,368 | nhn/tui.editor | src/js/markdownCommands/heading.js | getHeadingMarkdown | function getHeadingMarkdown(text, size) {
const foundedHeading = text.match(FIND_HEADING_RX);
let heading = '';
do {
heading += '#';
size -= 1;
} while (size > 0);
if (foundedHeading) {
[, text] = text.split(foundedHeading[0]);
}
return `${heading} ${text}`;
} | javascript | function getHeadingMarkdown(text, size) {
const foundedHeading = text.match(FIND_HEADING_RX);
let heading = '';
do {
heading += '#';
size -= 1;
} while (size > 0);
if (foundedHeading) {
[, text] = text.split(foundedHeading[0]);
}
return `${heading} ${text}`;
} | [
"function",
"getHeadingMarkdown",
"(",
"text",
",",
"size",
")",
"{",
"const",
"foundedHeading",
"=",
"text",
".",
"match",
"(",
"FIND_HEADING_RX",
")",
";",
"let",
"heading",
"=",
"''",
";",
"do",
"{",
"heading",
"+=",
"'#'",
";",
"size",
"-=",
"1",
"... | Get heading markdown
@param {string} text Source test
@param {number} size size
@returns {string} | [
"Get",
"heading",
"markdown"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/markdownCommands/heading.js#L65-L79 |
1,369 | nhn/tui.editor | src/js/extensions/chart/chart.js | parseCode2DataAndOptions | function parseCode2DataAndOptions(code, callback) {
code = trimKeepingTabs(code);
const [firstCode, secondCode] = code.split(/\n{2,}/);
// try to parse first code block as `options`
let options = parseCode2ChartOption(firstCode);
const url = options && options.editorChart && options.editorChart.url;
// if... | javascript | function parseCode2DataAndOptions(code, callback) {
code = trimKeepingTabs(code);
const [firstCode, secondCode] = code.split(/\n{2,}/);
// try to parse first code block as `options`
let options = parseCode2ChartOption(firstCode);
const url = options && options.editorChart && options.editorChart.url;
// if... | [
"function",
"parseCode2DataAndOptions",
"(",
"code",
",",
"callback",
")",
"{",
"code",
"=",
"trimKeepingTabs",
"(",
"code",
")",
";",
"const",
"[",
"firstCode",
",",
"secondCode",
"]",
"=",
"code",
".",
"split",
"(",
"/",
"\\n{2,}",
"/",
")",
";",
"// t... | parse data and options for tui.chart
data format can be csv, tsv
options format is colon separated keys & values
@param {string} code - plain text format data & options
@param {Function} callback - callback which provides json format data & options
@ignore | [
"parse",
"data",
"and",
"options",
"for",
"tui",
".",
"chart",
"data",
"format",
"can",
"be",
"csv",
"tsv",
"options",
"format",
"is",
"colon",
"separated",
"keys",
"&",
"values"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/chart/chart.js#L67-L92 |
1,370 | nhn/tui.editor | src/js/extensions/chart/chart.js | _parseCode2DataAndOptions | function _parseCode2DataAndOptions(dataCode, optionCode) {
const data = parseDSV2ChartData(dataCode);
const options = parseCode2ChartOption(optionCode);
return {
data,
options
};
} | javascript | function _parseCode2DataAndOptions(dataCode, optionCode) {
const data = parseDSV2ChartData(dataCode);
const options = parseCode2ChartOption(optionCode);
return {
data,
options
};
} | [
"function",
"_parseCode2DataAndOptions",
"(",
"dataCode",
",",
"optionCode",
")",
"{",
"const",
"data",
"=",
"parseDSV2ChartData",
"(",
"dataCode",
")",
";",
"const",
"options",
"=",
"parseCode2ChartOption",
"(",
"optionCode",
")",
";",
"return",
"{",
"data",
",... | parse codes to chart data & options Object
@param {string} dataCode - code block containing chart data
@param {string} optionCode - code block containing chart options
@returns {Object} - tui.chart data & options
@see https://nhn.github.io/tui.chart/latest/tui.chart.html
@ignore | [
"parse",
"codes",
"to",
"chart",
"data",
"&",
"options",
"Object"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/chart/chart.js#L102-L110 |
1,371 | nhn/tui.editor | src/js/extensions/chart/chart.js | detectDelimiter | function detectDelimiter(code) {
code = trimKeepingTabs(code);
// chunk first max 10 lines to detect
const chunk = code.split(REGEX_LINE_ENDING).slice(0, 10).join('\n');
// calc delta for each delimiters
// then pick a delimiter having the minimum value delta
return DSV_DELIMITERS.map(delimiter => ({
... | javascript | function detectDelimiter(code) {
code = trimKeepingTabs(code);
// chunk first max 10 lines to detect
const chunk = code.split(REGEX_LINE_ENDING).slice(0, 10).join('\n');
// calc delta for each delimiters
// then pick a delimiter having the minimum value delta
return DSV_DELIMITERS.map(delimiter => ({
... | [
"function",
"detectDelimiter",
"(",
"code",
")",
"{",
"code",
"=",
"trimKeepingTabs",
"(",
"code",
")",
";",
"// chunk first max 10 lines to detect",
"const",
"chunk",
"=",
"code",
".",
"split",
"(",
"REGEX_LINE_ENDING",
")",
".",
"slice",
"(",
"0",
",",
"10",... | detect delimiter the comma, tab, regex
@param {string} code - code to detect delimiter
@returns {string|RegExp} - detected delimiter
@ignore | [
"detect",
"delimiter",
"the",
"comma",
"tab",
"regex"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/chart/chart.js#L118-L132 |
1,372 | nhn/tui.editor | src/js/extensions/chart/chart.js | parseDSV2ChartData | function parseDSV2ChartData(code, delimiter) {
// trim all heading/trailing blank lines
code = trimKeepingTabs(code);
csv.COLUMN_SEPARATOR = delimiter || detectDelimiter(code);
let dsv = csv.parse(code);
// trim all values in 2D array
dsv = dsv.map(arr => arr.map(val => val.trim()));
// test a first ro... | javascript | function parseDSV2ChartData(code, delimiter) {
// trim all heading/trailing blank lines
code = trimKeepingTabs(code);
csv.COLUMN_SEPARATOR = delimiter || detectDelimiter(code);
let dsv = csv.parse(code);
// trim all values in 2D array
dsv = dsv.map(arr => arr.map(val => val.trim()));
// test a first ro... | [
"function",
"parseDSV2ChartData",
"(",
"code",
",",
"delimiter",
")",
"{",
"// trim all heading/trailing blank lines",
"code",
"=",
"trimKeepingTabs",
"(",
"code",
")",
";",
"csv",
".",
"COLUMN_SEPARATOR",
"=",
"delimiter",
"||",
"detectDelimiter",
"(",
"code",
")",... | parse csv, tsv to chart data
@param {string} code - data code
@param {string|RegExp} delimiter - delimiter
@returns {Object} - tui.chart data
@see https://nhn.github.io/tui.chart/latest/tui.chart.html
@ignore | [
"parse",
"csv",
"tsv",
"to",
"chart",
"data"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/chart/chart.js#L177-L216 |
1,373 | nhn/tui.editor | src/js/extensions/chart/chart.js | parseURL2ChartData | function parseURL2ChartData(url, callback) {
const success = code => {
const chartData = parseDSV2ChartData(code);
callback(chartData);
};
const fail = () => callback(null);
$.get(url).done(success).fail(fail);
} | javascript | function parseURL2ChartData(url, callback) {
const success = code => {
const chartData = parseDSV2ChartData(code);
callback(chartData);
};
const fail = () => callback(null);
$.get(url).done(success).fail(fail);
} | [
"function",
"parseURL2ChartData",
"(",
"url",
",",
"callback",
")",
"{",
"const",
"success",
"=",
"code",
"=>",
"{",
"const",
"chartData",
"=",
"parseDSV2ChartData",
"(",
"code",
")",
";",
"callback",
"(",
"chartData",
")",
";",
"}",
";",
"const",
"fail",
... | parse code from url
@param {string} url - remote csv/tsv file url
@param {Function} callback - callback function
@ignore | [
"parse",
"code",
"from",
"url"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/chart/chart.js#L224-L233 |
1,374 | nhn/tui.editor | src/js/extensions/chart/chart.js | parseCode2ChartOption | function parseCode2ChartOption(optionCode) {
const reservedKeys = ['type', 'url'];
let options = {};
if (util.isUndefined(optionCode)) {
return options;
}
const optionLines = optionCode.split(REGEX_LINE_ENDING);
optionLines.forEach(line => {
let [keyString, ...values] = line.split(OPTION_DELIMITER)... | javascript | function parseCode2ChartOption(optionCode) {
const reservedKeys = ['type', 'url'];
let options = {};
if (util.isUndefined(optionCode)) {
return options;
}
const optionLines = optionCode.split(REGEX_LINE_ENDING);
optionLines.forEach(line => {
let [keyString, ...values] = line.split(OPTION_DELIMITER)... | [
"function",
"parseCode2ChartOption",
"(",
"optionCode",
")",
"{",
"const",
"reservedKeys",
"=",
"[",
"'type'",
",",
"'url'",
"]",
";",
"let",
"options",
"=",
"{",
"}",
";",
"if",
"(",
"util",
".",
"isUndefined",
"(",
"optionCode",
")",
")",
"{",
"return"... | parse option code
@param {string} optionCode - option code
@returns {Object} - tui.chart option string
@see https://nhn.github.io/tui.chart/latest/tui.chart.html
@ignore | [
"parse",
"option",
"code"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/chart/chart.js#L242-L287 |
1,375 | nhn/tui.editor | src/js/extensions/chart/chart.js | setDefaultOptions | function setDefaultOptions(chartOptions, extensionOptions, chartContainer) {
// chart options scaffolding
chartOptions = util.extend({
editorChart: {},
chart: {},
chartExportMenu: {},
usageStatistics: extensionOptions.usageStatistics
}, chartOptions);
// set default extension options
extensio... | javascript | function setDefaultOptions(chartOptions, extensionOptions, chartContainer) {
// chart options scaffolding
chartOptions = util.extend({
editorChart: {},
chart: {},
chartExportMenu: {},
usageStatistics: extensionOptions.usageStatistics
}, chartOptions);
// set default extension options
extensio... | [
"function",
"setDefaultOptions",
"(",
"chartOptions",
",",
"extensionOptions",
",",
"chartContainer",
")",
"{",
"// chart options scaffolding",
"chartOptions",
"=",
"util",
".",
"extend",
"(",
"{",
"editorChart",
":",
"{",
"}",
",",
"chart",
":",
"{",
"}",
",",
... | set default options
@param {Object} chartOptions - tui.chart options
@param {Object} extensionOptions - extension options
@param {HTMLElement} chartContainer - chart container
@returns {Object} - options
@see https://nhn.github.io/tui.chart/latest/tui.chart.html
@ignore | [
"set",
"default",
"options"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/chart/chart.js#L319-L357 |
1,376 | nhn/tui.editor | src/js/extensions/chart/chart.js | chartReplacer | function chartReplacer(codeBlockChartDataAndOptions, extensionOptions) {
const randomId = `chart-${Math.random().toString(36).substr(2, 10)}`;
let renderedHTML = `<div id="${randomId}" class="chart" />`;
setTimeout(() => {
const chartContainer = document.querySelector(`#${randomId}`);
try {
parseCo... | javascript | function chartReplacer(codeBlockChartDataAndOptions, extensionOptions) {
const randomId = `chart-${Math.random().toString(36).substr(2, 10)}`;
let renderedHTML = `<div id="${randomId}" class="chart" />`;
setTimeout(() => {
const chartContainer = document.querySelector(`#${randomId}`);
try {
parseCo... | [
"function",
"chartReplacer",
"(",
"codeBlockChartDataAndOptions",
",",
"extensionOptions",
")",
"{",
"const",
"randomId",
"=",
"`",
"${",
"Math",
".",
"random",
"(",
")",
".",
"toString",
"(",
"36",
")",
".",
"substr",
"(",
"2",
",",
"10",
")",
"}",
"`",... | replace html from chart data
@param {string} codeBlockChartDataAndOptions - chart data text
@param {Object} extensionOptions - chart extension options
@returns {string} - rendered html
@ignore | [
"replace",
"html",
"from",
"chart",
"data"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/chart/chart.js#L366-L392 |
1,377 | nhn/tui.editor | src/js/extensions/chart/chart.js | _reduceToTSV | function _reduceToTSV(arr) {
// 2D array => quoted TSV row array
// [['a', 'b b'], [1, 2]] => ['a\t"b b"', '1\t2']
return arr.reduce((acc, row) => {
// ['a', 'b b', 'c c'] => ['a', '"b b"', '"c c"']
const quoted = row.map(text => {
if (!isNumeric(text) && text.indexOf(' ') >= 0) {
text = `"$... | javascript | function _reduceToTSV(arr) {
// 2D array => quoted TSV row array
// [['a', 'b b'], [1, 2]] => ['a\t"b b"', '1\t2']
return arr.reduce((acc, row) => {
// ['a', 'b b', 'c c'] => ['a', '"b b"', '"c c"']
const quoted = row.map(text => {
if (!isNumeric(text) && text.indexOf(' ') >= 0) {
text = `"$... | [
"function",
"_reduceToTSV",
"(",
"arr",
")",
"{",
"// 2D array => quoted TSV row array",
"// [['a', 'b b'], [1, 2]] => ['a\\t\"b b\"', '1\\t2']",
"return",
"arr",
".",
"reduce",
"(",
"(",
"acc",
",",
"row",
")",
"=>",
"{",
"// ['a', 'b b', 'c c'] => ['a', '\"b b\"', '\"c c\"'... | reduce 2D array to TSV rows
@param {Array.<Array.<string>>} arr - 2d array
@returns {Array.<string>} - TSV row array
@ignore | [
"reduce",
"2D",
"array",
"to",
"TSV",
"rows"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/chart/chart.js#L400-L417 |
1,378 | nhn/tui.editor | src/js/extensions/chart/chart.js | _setWwCodeBlockManagerForChart | function _setWwCodeBlockManagerForChart(editor) {
const componentManager = editor.wwEditor.componentManager;
componentManager.removeManager('codeblock');
componentManager.addManager(class extends WwCodeBlockManager {
/**
* Convert table nodes into code block as TSV
* @memberof WwCodeBlockManager
... | javascript | function _setWwCodeBlockManagerForChart(editor) {
const componentManager = editor.wwEditor.componentManager;
componentManager.removeManager('codeblock');
componentManager.addManager(class extends WwCodeBlockManager {
/**
* Convert table nodes into code block as TSV
* @memberof WwCodeBlockManager
... | [
"function",
"_setWwCodeBlockManagerForChart",
"(",
"editor",
")",
"{",
"const",
"componentManager",
"=",
"editor",
".",
"wwEditor",
".",
"componentManager",
";",
"componentManager",
".",
"removeManager",
"(",
"'codeblock'",
")",
";",
"componentManager",
".",
"addManag... | override WwCodeBlockManager to enclose pasting data strings from wysiwyg in quotes
@param {Editor} editor - editor
@ignore | [
"override",
"WwCodeBlockManager",
"to",
"enclose",
"pasting",
"data",
"strings",
"from",
"wysiwyg",
"in",
"quotes"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/chart/chart.js#L424-L455 |
1,379 | nhn/tui.editor | src/js/extensions/chart/chart.js | _onMDPasteBefore | function _onMDPasteBefore(cm, {source, data: eventData}) {
if (!_isFromCodeBlockInCodeMirror(cm, source, eventData)) {
return;
}
const code = eventData.text.join('\n');
const delta = calcDSVDelta(code, '\t');
if (delta === 0) {
csv.COLUMN_SEPARATOR = '\t';
const parsed = _reduceToTSV(csv.parse(c... | javascript | function _onMDPasteBefore(cm, {source, data: eventData}) {
if (!_isFromCodeBlockInCodeMirror(cm, source, eventData)) {
return;
}
const code = eventData.text.join('\n');
const delta = calcDSVDelta(code, '\t');
if (delta === 0) {
csv.COLUMN_SEPARATOR = '\t';
const parsed = _reduceToTSV(csv.parse(c... | [
"function",
"_onMDPasteBefore",
"(",
"cm",
",",
"{",
"source",
",",
"data",
":",
"eventData",
"}",
")",
"{",
"if",
"(",
"!",
"_isFromCodeBlockInCodeMirror",
"(",
"cm",
",",
"source",
",",
"eventData",
")",
")",
"{",
"return",
";",
"}",
"const",
"code",
... | enclose pasting data strings from markdown in quotes
wysiwyg event should be treated separately.
because pasteBefore event from wysiwyg has been already processed table data to string,
on the other hand we need a table element
@param {CodeMirror} cm - markdown codemirror editor
@param {string} source - event source
@pa... | [
"enclose",
"pasting",
"data",
"strings",
"from",
"markdown",
"in",
"quotes",
"wysiwyg",
"event",
"should",
"be",
"treated",
"separately",
".",
"because",
"pasteBefore",
"event",
"from",
"wysiwyg",
"has",
"been",
"already",
"processed",
"table",
"data",
"to",
"st... | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/chart/chart.js#L486-L499 |
1,380 | nhn/tui.editor | src/js/wysiwygCommands/tableAddRow.js | getSelectedRowsLength | function getSelectedRowsLength(wwe) {
const selectionMgr = wwe.componentManager.getManager('tableSelection');
const $selectedCells = selectionMgr.getSelectedCells();
let length = 1;
if ($selectedCells.length > 1) {
const first = $selectedCells.first().get(0);
const last = $selectedCells.last().get(0);
... | javascript | function getSelectedRowsLength(wwe) {
const selectionMgr = wwe.componentManager.getManager('tableSelection');
const $selectedCells = selectionMgr.getSelectedCells();
let length = 1;
if ($selectedCells.length > 1) {
const first = $selectedCells.first().get(0);
const last = $selectedCells.last().get(0);
... | [
"function",
"getSelectedRowsLength",
"(",
"wwe",
")",
"{",
"const",
"selectionMgr",
"=",
"wwe",
".",
"componentManager",
".",
"getManager",
"(",
"'tableSelection'",
")",
";",
"const",
"$selectedCells",
"=",
"selectionMgr",
".",
"getSelectedCells",
"(",
")",
";",
... | get number of selected rows
@param {WysiwygEditor} wwe - wysiwygEditor instance
@returns {number} - number of selected rows
@ignore | [
"get",
"number",
"of",
"selected",
"rows"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/tableAddRow.js#L59-L72 |
1,381 | nhn/tui.editor | src/js/wysiwygCommands/tableAddRow.js | getNewRow | function getNewRow($tr) {
const cloned = $tr.clone();
const htmlString = util.browser.msie ? '' : '<br />';
cloned.find('td').html(htmlString);
return cloned;
} | javascript | function getNewRow($tr) {
const cloned = $tr.clone();
const htmlString = util.browser.msie ? '' : '<br />';
cloned.find('td').html(htmlString);
return cloned;
} | [
"function",
"getNewRow",
"(",
"$tr",
")",
"{",
"const",
"cloned",
"=",
"$tr",
".",
"clone",
"(",
")",
";",
"const",
"htmlString",
"=",
"util",
".",
"browser",
".",
"msie",
"?",
"''",
":",
"'<br />'",
";",
"cloned",
".",
"find",
"(",
"'td'",
")",
".... | Get new row of given row
@param {jQuery} $tr - jQuery wrapped table row
@returns {jQuery} - new cloned jquery element
@ignore | [
"Get",
"new",
"row",
"of",
"given",
"row"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/tableAddRow.js#L80-L87 |
1,382 | nhn/tui.editor | src/js/htmlSanitizer.js | leaveOnlyWhitelistAttribute | function leaveOnlyWhitelistAttribute($html) {
$html.find('*').each((index, node) => {
const attrs = node.attributes;
const blacklist = util.toArray(attrs).filter(attr => {
const isHTMLAttr = attr.name.match(HTML_ATTR_LIST_RX);
const isSVGAttr = attr.name.match(SVG_ATTR_LIST_RX);
return !isH... | javascript | function leaveOnlyWhitelistAttribute($html) {
$html.find('*').each((index, node) => {
const attrs = node.attributes;
const blacklist = util.toArray(attrs).filter(attr => {
const isHTMLAttr = attr.name.match(HTML_ATTR_LIST_RX);
const isSVGAttr = attr.name.match(SVG_ATTR_LIST_RX);
return !isH... | [
"function",
"leaveOnlyWhitelistAttribute",
"(",
"$html",
")",
"{",
"$html",
".",
"find",
"(",
"'*'",
")",
".",
"each",
"(",
"(",
"index",
",",
"node",
")",
"=>",
"{",
"const",
"attrs",
"=",
"node",
".",
"attributes",
";",
"const",
"blacklist",
"=",
"ut... | Leave only white list attributes
@private
@param {jQuery} $html jQuery instance | [
"Leave",
"only",
"white",
"list",
"attributes"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/htmlSanitizer.js#L65-L83 |
1,383 | nhn/tui.editor | src/js/htmlSanitizer.js | finalizeHtml | function finalizeHtml($html, needHtmlText) {
let returnValue;
if (needHtmlText) {
returnValue = $html[0].innerHTML;
} else {
const frag = document.createDocumentFragment();
const childNodes = util.toArray($html[0].childNodes);
const {length} = childNodes;
for (let i = 0; i < length; i += 1) ... | javascript | function finalizeHtml($html, needHtmlText) {
let returnValue;
if (needHtmlText) {
returnValue = $html[0].innerHTML;
} else {
const frag = document.createDocumentFragment();
const childNodes = util.toArray($html[0].childNodes);
const {length} = childNodes;
for (let i = 0; i < length; i += 1) ... | [
"function",
"finalizeHtml",
"(",
"$html",
",",
"needHtmlText",
")",
"{",
"let",
"returnValue",
";",
"if",
"(",
"needHtmlText",
")",
"{",
"returnValue",
"=",
"$html",
"[",
"0",
"]",
".",
"innerHTML",
";",
"}",
"else",
"{",
"const",
"frag",
"=",
"document"... | Finalize html result
@private
@param {jQuery} $html jQuery instance
@param {boolean} needHtmlText pass true if need html text
@returns {string|DocumentFragment} result | [
"Finalize",
"html",
"result"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/htmlSanitizer.js#L92-L109 |
1,384 | nhn/tui.editor | src/js/extensions/table/tableRangeHandler.js | _findUnmergedRange | function _findUnmergedRange(tableData, $start, $end) {
const cellIndexData = tableDataHandler.createCellIndexData(tableData);
const startCellIndex = tableDataHandler.findCellIndex(cellIndexData, $start);
const endCellIndex = tableDataHandler.findCellIndex(cellIndexData, $end);
let startRowIndex, endRowIndex, st... | javascript | function _findUnmergedRange(tableData, $start, $end) {
const cellIndexData = tableDataHandler.createCellIndexData(tableData);
const startCellIndex = tableDataHandler.findCellIndex(cellIndexData, $start);
const endCellIndex = tableDataHandler.findCellIndex(cellIndexData, $end);
let startRowIndex, endRowIndex, st... | [
"function",
"_findUnmergedRange",
"(",
"tableData",
",",
"$start",
",",
"$end",
")",
"{",
"const",
"cellIndexData",
"=",
"tableDataHandler",
".",
"createCellIndexData",
"(",
"tableData",
")",
";",
"const",
"startCellIndex",
"=",
"tableDataHandler",
".",
"findCellInd... | Find unmerged table range.
@param {Array.<Array.<object>>} tableData - table data
@param {jQuery} $start - start talbe cell jQuery element
@param {jQuery} $end - end table cell jQuery element
@returns {{
start: {rowIndex: number, colIndex: number},
end: {rowIndex: number, colIndex: number}
}}
@private | [
"Find",
"unmerged",
"table",
"range",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/tableRangeHandler.js#L21-L53 |
1,385 | nhn/tui.editor | src/js/extensions/table/tableRangeHandler.js | _expandRowMergedRange | function _expandRowMergedRange(tableData, tableRange, rangeType) {
const {rowIndex} = tableRange[rangeType];
const rowData = tableData[rowIndex];
util.range(tableRange.start.colIndex, tableRange.end.colIndex + 1).forEach(colIndex => {
const cellData = rowData[colIndex];
const {rowMergeWith} = cellData;
... | javascript | function _expandRowMergedRange(tableData, tableRange, rangeType) {
const {rowIndex} = tableRange[rangeType];
const rowData = tableData[rowIndex];
util.range(tableRange.start.colIndex, tableRange.end.colIndex + 1).forEach(colIndex => {
const cellData = rowData[colIndex];
const {rowMergeWith} = cellData;
... | [
"function",
"_expandRowMergedRange",
"(",
"tableData",
",",
"tableRange",
",",
"rangeType",
")",
"{",
"const",
"{",
"rowIndex",
"}",
"=",
"tableRange",
"[",
"rangeType",
"]",
";",
"const",
"rowData",
"=",
"tableData",
"[",
"rowIndex",
"]",
";",
"util",
".",
... | Expand table range by row merge properties like rowspan, rowMergeWith.
@param {Array.<Array.<object>>} tableData - table data
@param {{
start: {rowIndex: number, colIndex: number},
end: {rowIndex: number, colIndex: number}
}} tableRange - table range
@param {string} rangeType - range type like start, end
@private | [
"Expand",
"table",
"range",
"by",
"row",
"merge",
"properties",
"like",
"rowspan",
"rowMergeWith",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/tableRangeHandler.js#L65-L88 |
1,386 | nhn/tui.editor | src/js/extensions/table/tableRangeHandler.js | _expandColMergedRange | function _expandColMergedRange(tableData, tableRange, rowIndex, colIndex) {
const rowData = tableData[rowIndex];
const cellData = rowData[colIndex];
const {colMergeWith} = cellData;
let lastColMergedIndex = -1;
if (util.isExisty(colMergeWith)) {
if (colMergeWith < tableRange.start.colIndex) {
table... | javascript | function _expandColMergedRange(tableData, tableRange, rowIndex, colIndex) {
const rowData = tableData[rowIndex];
const cellData = rowData[colIndex];
const {colMergeWith} = cellData;
let lastColMergedIndex = -1;
if (util.isExisty(colMergeWith)) {
if (colMergeWith < tableRange.start.colIndex) {
table... | [
"function",
"_expandColMergedRange",
"(",
"tableData",
",",
"tableRange",
",",
"rowIndex",
",",
"colIndex",
")",
"{",
"const",
"rowData",
"=",
"tableData",
"[",
"rowIndex",
"]",
";",
"const",
"cellData",
"=",
"rowData",
"[",
"colIndex",
"]",
";",
"const",
"{... | Expand table range by column merge properties like colspan, colMergeWith.
@param {Array.<Array.<object>>} tableData - table data
@param {{
start: {rowIndex: number, colIndex: number},
end: {rowIndex: number, colIndex: number}
}} tableRange - table range
@param {number} rowIndex - row index
@param {number} colIndex - co... | [
"Expand",
"table",
"range",
"by",
"column",
"merge",
"properties",
"like",
"colspan",
"colMergeWith",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/tableRangeHandler.js#L101-L120 |
1,387 | nhn/tui.editor | src/js/extensions/table/tableRangeHandler.js | _expandMergedRange | function _expandMergedRange(tableData, tableRange) {
let rangeStr = '';
while (rangeStr !== JSON.stringify(tableRange)) {
rangeStr = JSON.stringify(tableRange);
_expandRowMergedRange(tableData, tableRange, 'start');
_expandRowMergedRange(tableData, tableRange, 'end');
util.range(tableRange.start.... | javascript | function _expandMergedRange(tableData, tableRange) {
let rangeStr = '';
while (rangeStr !== JSON.stringify(tableRange)) {
rangeStr = JSON.stringify(tableRange);
_expandRowMergedRange(tableData, tableRange, 'start');
_expandRowMergedRange(tableData, tableRange, 'end');
util.range(tableRange.start.... | [
"function",
"_expandMergedRange",
"(",
"tableData",
",",
"tableRange",
")",
"{",
"let",
"rangeStr",
"=",
"''",
";",
"while",
"(",
"rangeStr",
"!==",
"JSON",
".",
"stringify",
"(",
"tableRange",
")",
")",
"{",
"rangeStr",
"=",
"JSON",
".",
"stringify",
"(",... | Expand table range by merge properties like colspan, rowspan.
@param {Array.<Array.<object>>} tableData - table data
@param {{
start: {rowIndex: number, colIndex: number},
end: {rowIndex: number, colIndex: number}
}} tableRange - table range
@returns {{
start: {rowIndex: number, colIndex: number},
end: {rowIndex: numbe... | [
"Expand",
"table",
"range",
"by",
"merge",
"properties",
"like",
"colspan",
"rowspan",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/tableRangeHandler.js#L135-L151 |
1,388 | nhn/tui.editor | src/js/extensions/table/tableRangeHandler.js | getTableSelectionRange | function getTableSelectionRange(tableData, $selectedCells, $startContainer) {
const cellIndexData = tableDataHandler.createCellIndexData(tableData);
const tableRange = {};
if ($selectedCells.length) {
const startRange = tableDataHandler.findCellIndex(cellIndexData, $selectedCells.first());
const endRange... | javascript | function getTableSelectionRange(tableData, $selectedCells, $startContainer) {
const cellIndexData = tableDataHandler.createCellIndexData(tableData);
const tableRange = {};
if ($selectedCells.length) {
const startRange = tableDataHandler.findCellIndex(cellIndexData, $selectedCells.first());
const endRange... | [
"function",
"getTableSelectionRange",
"(",
"tableData",
",",
"$selectedCells",
",",
"$startContainer",
")",
"{",
"const",
"cellIndexData",
"=",
"tableDataHandler",
".",
"createCellIndexData",
"(",
"tableData",
")",
";",
"const",
"tableRange",
"=",
"{",
"}",
";",
"... | Get table selection range.
@param {Array.<Array.<object>>} tableData - table data
@param {jQuery} $selectedCells - selected cells jQuery elements
@param {jQuery} $startContainer - start container jQuery element of text range
@returns {{
start: {rowIndex: number, colIndex: number},
end: {rowIndex: number, colIndex: numb... | [
"Get",
"table",
"selection",
"range",
"."
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/table/tableRangeHandler.js#L181-L209 |
1,389 | nhn/tui.editor | src/js/wysiwygCommands/tableAlignCol.js | setAlignAttributeToTableCells | function setAlignAttributeToTableCells($table, alignDirection, selectionInformation) {
const isDivided = selectionInformation.isDivided || false;
const start = selectionInformation.startColumnIndex;
const end = selectionInformation.endColumnIndex;
const columnLength = $table.find('tr').eq(0).find('td,th').lengt... | javascript | function setAlignAttributeToTableCells($table, alignDirection, selectionInformation) {
const isDivided = selectionInformation.isDivided || false;
const start = selectionInformation.startColumnIndex;
const end = selectionInformation.endColumnIndex;
const columnLength = $table.find('tr').eq(0).find('td,th').lengt... | [
"function",
"setAlignAttributeToTableCells",
"(",
"$table",
",",
"alignDirection",
",",
"selectionInformation",
")",
"{",
"const",
"isDivided",
"=",
"selectionInformation",
".",
"isDivided",
"||",
"false",
";",
"const",
"start",
"=",
"selectionInformation",
".",
"star... | Set Column align
@param {jQuery} $table jQuery wrapped TABLE
@param {string} alignDirection 'left' or 'center' or 'right'
@param {{
startColumnIndex: number,
endColumnIndex: number,
isDivided: boolean
}} selectionInformation start, end column index and boolean value for whether range divided or not | [
"Set",
"Column",
"align"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/tableAlignCol.js#L55-L72 |
1,390 | nhn/tui.editor | src/js/wysiwygCommands/tableAlignCol.js | getSelectionInformation | function getSelectionInformation($table, rangeInformation) {
const columnLength = $table.find('tr').eq(0).find('td,th').length;
const {
from,
to
} = rangeInformation;
let startColumnIndex, endColumnIndex, isDivided;
if (from.row === to.row) {
startColumnIndex = from.cell;
endColumnIndex = to.... | javascript | function getSelectionInformation($table, rangeInformation) {
const columnLength = $table.find('tr').eq(0).find('td,th').length;
const {
from,
to
} = rangeInformation;
let startColumnIndex, endColumnIndex, isDivided;
if (from.row === to.row) {
startColumnIndex = from.cell;
endColumnIndex = to.... | [
"function",
"getSelectionInformation",
"(",
"$table",
",",
"rangeInformation",
")",
"{",
"const",
"columnLength",
"=",
"$table",
".",
"find",
"(",
"'tr'",
")",
".",
"eq",
"(",
"0",
")",
".",
"find",
"(",
"'td,th'",
")",
".",
"length",
";",
"const",
"{",
... | Return start, end column index and boolean value for whether range divided or not
@param {jQuery} $table jQuery wrapped TABLE
@param {{startColumnIndex: number, endColumnIndex: number}} rangeInformation Range information
@returns {{startColumnIndex: number, endColumnIndex: number, isDivided: boolean}} | [
"Return",
"start",
"end",
"column",
"index",
"and",
"boolean",
"value",
"for",
"whether",
"range",
"divided",
"or",
"not"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/tableAlignCol.js#L80-L107 |
1,391 | nhn/tui.editor | src/js/wysiwygCommands/tableAlignCol.js | getRangeInformation | function getRangeInformation(range, selectionMgr) {
const $selectedCells = selectionMgr.getSelectedCells();
let rangeInformation, startCell;
if ($selectedCells.length) {
rangeInformation = selectionMgr.getSelectionRangeFromTable($selectedCells.first().get(0),
$selectedCells.last().get(0));
} else {
... | javascript | function getRangeInformation(range, selectionMgr) {
const $selectedCells = selectionMgr.getSelectedCells();
let rangeInformation, startCell;
if ($selectedCells.length) {
rangeInformation = selectionMgr.getSelectionRangeFromTable($selectedCells.first().get(0),
$selectedCells.last().get(0));
} else {
... | [
"function",
"getRangeInformation",
"(",
"range",
",",
"selectionMgr",
")",
"{",
"const",
"$selectedCells",
"=",
"selectionMgr",
".",
"getSelectedCells",
"(",
")",
";",
"let",
"rangeInformation",
",",
"startCell",
";",
"if",
"(",
"$selectedCells",
".",
"length",
... | Get range information
@param {Range} range Range object
@param {object} selectionMgr Table selection manager
@returns {object} | [
"Get",
"range",
"information"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/wysiwygCommands/tableAlignCol.js#L115-L129 |
1,392 | nhn/tui.editor | src/js/extensions/taskCounter.js | taskCounterExtension | function taskCounterExtension(editor) {
editor.getTaskCount = () => {
let found, count;
if (editor.isViewer()) {
count = editor.preview.$el.find('.task-list-item').length;
} else if (editor.isMarkdownMode()) {
found = editor.mdEditor.getValue().match(FIND_TASK_RX);
count = found ? found... | javascript | function taskCounterExtension(editor) {
editor.getTaskCount = () => {
let found, count;
if (editor.isViewer()) {
count = editor.preview.$el.find('.task-list-item').length;
} else if (editor.isMarkdownMode()) {
found = editor.mdEditor.getValue().match(FIND_TASK_RX);
count = found ? found... | [
"function",
"taskCounterExtension",
"(",
"editor",
")",
"{",
"editor",
".",
"getTaskCount",
"=",
"(",
")",
"=>",
"{",
"let",
"found",
",",
"count",
";",
"if",
"(",
"editor",
".",
"isViewer",
"(",
")",
")",
"{",
"count",
"=",
"editor",
".",
"preview",
... | task counter extension
@param {Editor} editor - editor instance
@ignore | [
"task",
"counter",
"extension"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/taskCounter.js#L15-L45 |
1,393 | nhn/tui.editor | src/js/extensions/scrollSync/scrollSync.js | changeButtonVisiblityStateIfNeed | function changeButtonVisiblityStateIfNeed() {
if (editor.mdPreviewStyle === 'vertical' && editor.currentMode === 'markdown') {
button.$el.show();
$divider.show();
} else {
button.$el.hide();
$divider.hide();
}
} | javascript | function changeButtonVisiblityStateIfNeed() {
if (editor.mdPreviewStyle === 'vertical' && editor.currentMode === 'markdown') {
button.$el.show();
$divider.show();
} else {
button.$el.hide();
$divider.hide();
}
} | [
"function",
"changeButtonVisiblityStateIfNeed",
"(",
")",
"{",
"if",
"(",
"editor",
".",
"mdPreviewStyle",
"===",
"'vertical'",
"&&",
"editor",
".",
"currentMode",
"===",
"'markdown'",
")",
"{",
"button",
".",
"$el",
".",
"show",
"(",
")",
";",
"$divider",
"... | change button visiblity state | [
"change",
"button",
"visiblity",
"state"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/scrollSync/scrollSync.js#L86-L94 |
1,394 | nhn/tui.editor | src/js/extensions/mark/mark.js | getHelper | function getHelper() {
let helper;
if (editor.isViewer()) {
helper = vmh;
} else if (editor.isWysiwygMode()) {
helper = wmh;
} else {
helper = mmh;
}
return helper;
} | javascript | function getHelper() {
let helper;
if (editor.isViewer()) {
helper = vmh;
} else if (editor.isWysiwygMode()) {
helper = wmh;
} else {
helper = mmh;
}
return helper;
} | [
"function",
"getHelper",
"(",
")",
"{",
"let",
"helper",
";",
"if",
"(",
"editor",
".",
"isViewer",
"(",
")",
")",
"{",
"helper",
"=",
"vmh",
";",
"}",
"else",
"if",
"(",
"editor",
".",
"isWysiwygMode",
"(",
")",
")",
"{",
"helper",
"=",
"wmh",
"... | getHelper
Get helper for current situation
@returns {object} helper | [
"getHelper",
"Get",
"helper",
"for",
"current",
"situation"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/mark/mark.js#L42-L54 |
1,395 | nhn/tui.editor | src/js/extensions/mark/mark.js | updateMarkWhenResizing | function updateMarkWhenResizing() {
const helper = getHelper();
ml.getAll().forEach(marker => {
helper.updateMarkerWithExtraInfo(marker);
});
editor.eventManager.emit('markerUpdated', ml.getAll());
} | javascript | function updateMarkWhenResizing() {
const helper = getHelper();
ml.getAll().forEach(marker => {
helper.updateMarkerWithExtraInfo(marker);
});
editor.eventManager.emit('markerUpdated', ml.getAll());
} | [
"function",
"updateMarkWhenResizing",
"(",
")",
"{",
"const",
"helper",
"=",
"getHelper",
"(",
")",
";",
"ml",
".",
"getAll",
"(",
")",
".",
"forEach",
"(",
"marker",
"=>",
"{",
"helper",
".",
"updateMarkerWithExtraInfo",
"(",
"marker",
")",
";",
"}",
")... | Update mark when resizing | [
"Update",
"mark",
"when",
"resizing"
] | e75ab08c2a7ab07d1143e318f7cde135c5e3002e | https://github.com/nhn/tui.editor/blob/e75ab08c2a7ab07d1143e318f7cde135c5e3002e/src/js/extensions/mark/mark.js#L59-L67 |
1,396 | semantic-release/semantic-release | lib/git.js | getTagHead | async function getTagHead(tagName, execaOpts) {
try {
return await execa.stdout('git', ['rev-list', '-1', tagName], execaOpts);
} catch (error) {
debug(error);
}
} | javascript | async function getTagHead(tagName, execaOpts) {
try {
return await execa.stdout('git', ['rev-list', '-1', tagName], execaOpts);
} catch (error) {
debug(error);
}
} | [
"async",
"function",
"getTagHead",
"(",
"tagName",
",",
"execaOpts",
")",
"{",
"try",
"{",
"return",
"await",
"execa",
".",
"stdout",
"(",
"'git'",
",",
"[",
"'rev-list'",
",",
"'-1'",
",",
"tagName",
"]",
",",
"execaOpts",
")",
";",
"}",
"catch",
"(",... | Get the commit sha for a given tag.
@param {String} tagName Tag name for which to retrieve the commit sha.
@param {Object} [execaOpts] Options to pass to `execa`.
@return {string} The commit sha of the tag in parameter or `null`. | [
"Get",
"the",
"commit",
"sha",
"for",
"a",
"given",
"tag",
"."
] | edf382f88838ed543c0b76cb6c914cca1fc1ddd1 | https://github.com/semantic-release/semantic-release/blob/edf382f88838ed543c0b76cb6c914cca1fc1ddd1/lib/git.js#L12-L18 |
1,397 | semantic-release/semantic-release | lib/git.js | getTags | async function getTags(execaOpts) {
return (await execa.stdout('git', ['tag'], execaOpts))
.split('\n')
.map(tag => tag.trim())
.filter(Boolean);
} | javascript | async function getTags(execaOpts) {
return (await execa.stdout('git', ['tag'], execaOpts))
.split('\n')
.map(tag => tag.trim())
.filter(Boolean);
} | [
"async",
"function",
"getTags",
"(",
"execaOpts",
")",
"{",
"return",
"(",
"await",
"execa",
".",
"stdout",
"(",
"'git'",
",",
"[",
"'tag'",
"]",
",",
"execaOpts",
")",
")",
".",
"split",
"(",
"'\\n'",
")",
".",
"map",
"(",
"tag",
"=>",
"tag",
".",... | Get all the repository tags.
@param {Object} [execaOpts] Options to pass to `execa`.
@return {Array<String>} List of git tags.
@throws {Error} If the `git` command fails. | [
"Get",
"all",
"the",
"repository",
"tags",
"."
] | edf382f88838ed543c0b76cb6c914cca1fc1ddd1 | https://github.com/semantic-release/semantic-release/blob/edf382f88838ed543c0b76cb6c914cca1fc1ddd1/lib/git.js#L28-L33 |
1,398 | semantic-release/semantic-release | lib/git.js | isRefInHistory | async function isRefInHistory(ref, execaOpts) {
try {
await execa('git', ['merge-base', '--is-ancestor', ref, 'HEAD'], execaOpts);
return true;
} catch (error) {
if (error.code === 1) {
return false;
}
debug(error);
throw error;
}
} | javascript | async function isRefInHistory(ref, execaOpts) {
try {
await execa('git', ['merge-base', '--is-ancestor', ref, 'HEAD'], execaOpts);
return true;
} catch (error) {
if (error.code === 1) {
return false;
}
debug(error);
throw error;
}
} | [
"async",
"function",
"isRefInHistory",
"(",
"ref",
",",
"execaOpts",
")",
"{",
"try",
"{",
"await",
"execa",
"(",
"'git'",
",",
"[",
"'merge-base'",
",",
"'--is-ancestor'",
",",
"ref",
",",
"'HEAD'",
"]",
",",
"execaOpts",
")",
";",
"return",
"true",
";"... | Verify if the `ref` is in the direct history of the current branch.
@param {String} ref The reference to look for.
@param {Object} [execaOpts] Options to pass to `execa`.
@return {Boolean} `true` if the reference is in the history of the current branch, falsy otherwise. | [
"Verify",
"if",
"the",
"ref",
"is",
"in",
"the",
"direct",
"history",
"of",
"the",
"current",
"branch",
"."
] | edf382f88838ed543c0b76cb6c914cca1fc1ddd1 | https://github.com/semantic-release/semantic-release/blob/edf382f88838ed543c0b76cb6c914cca1fc1ddd1/lib/git.js#L43-L55 |
1,399 | semantic-release/semantic-release | lib/git.js | fetch | async function fetch(repositoryUrl, execaOpts) {
try {
await execa('git', ['fetch', '--unshallow', '--tags', repositoryUrl], execaOpts);
} catch (error) {
await execa('git', ['fetch', '--tags', repositoryUrl], execaOpts);
}
} | javascript | async function fetch(repositoryUrl, execaOpts) {
try {
await execa('git', ['fetch', '--unshallow', '--tags', repositoryUrl], execaOpts);
} catch (error) {
await execa('git', ['fetch', '--tags', repositoryUrl], execaOpts);
}
} | [
"async",
"function",
"fetch",
"(",
"repositoryUrl",
",",
"execaOpts",
")",
"{",
"try",
"{",
"await",
"execa",
"(",
"'git'",
",",
"[",
"'fetch'",
",",
"'--unshallow'",
",",
"'--tags'",
",",
"repositoryUrl",
"]",
",",
"execaOpts",
")",
";",
"}",
"catch",
"... | Unshallow the git repository if necessary and fetch all the tags.
@param {String} repositoryUrl The remote repository URL.
@param {Object} [execaOpts] Options to pass to `execa`. | [
"Unshallow",
"the",
"git",
"repository",
"if",
"necessary",
"and",
"fetch",
"all",
"the",
"tags",
"."
] | edf382f88838ed543c0b76cb6c914cca1fc1ddd1 | https://github.com/semantic-release/semantic-release/blob/edf382f88838ed543c0b76cb6c914cca1fc1ddd1/lib/git.js#L63-L69 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.