Skip to content

Commit

Permalink
docs: internationalization
Browse files Browse the repository at this point in the history
  • Loading branch information
kyuwoo.choi committed Dec 21, 2017
1 parent 3f8e181 commit 848c83c
Show file tree
Hide file tree
Showing 62 changed files with 208 additions and 241 deletions.
12 changes: 6 additions & 6 deletions src/js/codemirror/markdown.js
Expand Up @@ -158,7 +158,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
}
state.list = null;
// TUI.EDITOR MODIFICATION START
// list 에서 하이라이팅이 제대로 안되는 버그
// bug: no highlight in list
// https://github.nhnent.com/fe/tui.editor/commit/d42c37639942633ccaf755c0c0d20f460c0b2441
// https://github.nhnent.com/fe/tui.editor/issues/1002
}
Expand Down Expand Up @@ -246,7 +246,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
// TUI.EDITOR MODIFICATION START
// Do not show table format pasting confirm on paste event where in Bloc... (#720)
// https://github.nhnent.com/fe/tui.editor/commit/ed0b8b6c0cd5928a962e533f797e5bafcbfd6b33
state.task = true; // task state 관리를 위해 추가
state.task = true; // to manage task state
// TUI.EDITOR MODIFICATION END
}
state.f = state.inline;
Expand Down Expand Up @@ -492,9 +492,9 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
if (ch === '!' && stream.match(/\[[^\]]*\] ?(?:\(|\[)/, false)) {
stream.match(/\[[^\]]*\]/);
// TUI.EDITOR MODIFICATION START
// 이미지문법 code mirror에서 hightlight 제거
// remove image syntax from highlight
// https://github.nhnent.com/fe/tui.editor/commit/d2160b8c16f392372569dc2a22f12957afd7d9f2
// 현재 이미지의 link를 hash값으로 사용하고 있어 데이터 문자열의 길이로 인해 highlight안되는 현상 발생, iamge의 경우 하이라이팅 하지 않음
// hash string in image link is too long to highligh. exclude image from highlight
// state.inline = state.f = linkHref;
// TUI.EDITOR MODIFICATION END
return image;
Expand Down Expand Up @@ -834,7 +834,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
// TUI.EDITOR MODIFICATION START
// Do not show table format pasting confirm on paste event where in Bloc... (#720)
// https://github.nhnent.com/fe/tui.editor/commit/ed0b8b6c0cd5928a962e533f797e5bafcbfd6b33
task: s.task, // task state 관리를 위해 추가
task: s.task, // to manage task state
// TUI.EDITOR MODIFICATION END
list: s.list,
listDepth: s.listDepth,
Expand Down Expand Up @@ -894,7 +894,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
// TUI.EDITOR MODIFICATION START
// Do not show table format pasting confirm on paste event where in Bloc... (#720)
// https://github.nhnent.com/fe/tui.editor/commit/ed0b8b6c0cd5928a962e533f797e5bafcbfd6b33
state.task = false; // task state 관리를 위해 추가
state.task = false; // to manage task status
// Reset state.code
// state.code = false;
// TUI.EDITOR MODIFICATION END
Expand Down
10 changes: 2 additions & 8 deletions src/js/domUtils.js
Expand Up @@ -126,8 +126,6 @@ const getChildNodeByOffset = function(node, index) {
/**
* getNodeWithDirectionUntil
* find next node from passed node
* 노드의 다음 노드를 찾는다 sibling노드가 없으면 부모레벨까지 올라가서 찾는다.
* 부모노드를 따라 올라가며 방향에 맞는 노드를 찾는다.
* @param {strong} direction previous or next
* @param {Node} node node
* @param {string} untilNodeName parent node name to limit
Expand Down Expand Up @@ -160,7 +158,6 @@ const getNodeWithDirectionUntil = function(direction, node, untilNodeName) {
/**
* getPrevOffsetNodeUntil
* get prev node of childnode pointed with index
* 인덱스에 해당하는 차일드 노드의 이전 노드를 찾는다.
* @param {Node} node node
* @param {number} index offset index
* @param {string} untilNodeName parent node name to limit
Expand Down Expand Up @@ -196,7 +193,6 @@ const getParentUntilBy = function(node, condition) {
/**
* getParentUntil
* get parent node until paseed node name
* 특정 노드이전의 부모 노드를 찾는다
* @param {Node} node node
* @param {string|HTMLNode} untilNode node name or node to limit
* @returns {Node} founded node
Expand All @@ -216,8 +212,7 @@ const getParentUntil = function(node, untilNode) {

/**
* getNodeWithDirectionUnderParent
* get node of direction before passed parent
* 주어진 노드 이전까지 찾아올라가서 방향에 맞는 노드를 찾는다.
* get node on the given direction under given parent
* @param {strong} direction previous or next
* @param {Node} node node
* @param {string|Node} underNode parent node name to limit
Expand Down Expand Up @@ -344,8 +339,7 @@ const findOffsetNode = function(root, offsetList, textNodeFilter) {
walkerOffset = newWalkerOffset;
}

// 오프셋에 해당하는 컨텐츠가 없는경우 컨텐츠 맨마지막으로 통일
// 중간에 return으로 빠져나가지 않고 여기까지 왔다는것은 남은 offset이 있는것임
// there should be offset left
do {
result.push({
container: walker.currentNode,
Expand Down
4 changes: 2 additions & 2 deletions src/js/editor.js
Expand Up @@ -177,9 +177,9 @@ class ToastUIEditor {
}

/**
* 프리뷰가 보여지는 방식을 변경한다
* change preview style
* @memberof ToastUIEditor
* @param {string} style 스타일 이름 tab, vertical
* @param {string} style - 'tab'|'vertical'
*/
changePreviewStyle(style) {
this.layout.changePreviewStyle(style);
Expand Down
6 changes: 3 additions & 3 deletions src/js/extensions/chart/chart.js
Expand Up @@ -10,9 +10,9 @@
* consumes tab separated values and make data/options for tui chart
*
* ```chart
* \t범례1\t범례2 => tsv, csv format chart data
* 1월\t21\t23
* 2월\t351\t45
* \tcat1\tcat2 => tsv, csv format chart data
* jan\t21\t23
* feb\t351\t45
* => space required as a separator
* type: area => tui.chart.areaChart()
* url: http://url.to/csv => fetch data from the url
Expand Down
6 changes: 3 additions & 3 deletions src/js/extensions/mark/markerManager.js
Expand Up @@ -106,7 +106,7 @@ class MarkerManager {

const changedLen = text.length;

// 이전 변경점 end를 이번 변경점 start로 만들어 위치를 조정한다.
// adjust location
changedStart = changedEnd;

if (type === CHANGE_NOTHING) {
Expand All @@ -117,10 +117,10 @@ class MarkerManager {
}

if (type === CHANGE_ADD) {
diffLen += changedLen; // 더해진경우는 End값이 변경될 필요가없다 변경전의 위치는 start와 end가 collapse일수밖에 없다.. 일반적인 컨트롤상황에서는
diffLen += changedLen; // almost everycase it's collapsed before it' been modified. no need to modify end value
} else if (type === CHANGE_MINUS) {
diffLen -= changedLen;
changedEnd += changedLen; // 빠지면 빠지기전까지의 범위가 end가 되어야한다.
changedEnd += changedLen; // add it back to changedEnd
}

iteratee(changedStart, changedEnd, diffLen);
Expand Down
5 changes: 5 additions & 0 deletions src/js/extensions/scrollSync/scrollSync.js
Expand Up @@ -9,6 +9,11 @@ import SectionManager from './sectionManager';

const {Button} = Editor;

/**
* scrollSync plugin
* @param {Editor} editor - editor
* @ignore
*/
function scrollSyncExtension(editor) {
const className = 'tui-scrollsync';
const i18n = editor.i18n;
Expand Down
3 changes: 1 addition & 2 deletions src/js/extensions/scrollSync/sectionManager.js
Expand Up @@ -164,8 +164,7 @@ class SectionManager {
isEnsuredSection = true;
}

// 빈공간으로 시작되다다가 헤더를 만난경우 섹션은 두개가 생성되는데
// 프리뷰에서는 빈공간이 트리밍되어 섹션 한개 밖에 생성되지 않아 매칭이 되지 않는 문제 해결
// resolve wrong number of sections mismatch compare to preview
if (isTrimming) {
trimCapture += lineString.trim();

Expand Down
2 changes: 1 addition & 1 deletion src/js/extensions/table/mergeCell.js
Expand Up @@ -19,7 +19,7 @@ if (CommandManager) {
name: 'MergeCells',
/**
* Command handler.
* @param {WysiwygEditor} wwe - WYsiwygEditor instance
* @param {WysiwygEditor} wwe - wysiwygEditor instance
*/
exec(wwe) {
const sq = wwe.getEditor();
Expand Down
2 changes: 1 addition & 1 deletion src/js/extensions/table/mergedTableAddCol.js
Expand Up @@ -18,7 +18,7 @@ if (CommandManager) {
name: 'AddCol',
/**
* Command handler.
* @param {WysiwygEditor} wwe - WYsiwygEditor instance
* @param {WysiwygEditor} wwe - wysiwygEditor instance
*/
exec(wwe) {
const sq = wwe.getEditor();
Expand Down
2 changes: 1 addition & 1 deletion src/js/extensions/table/mergedTableAddRow.js
Expand Up @@ -18,7 +18,7 @@ if (CommandManager) {
name: 'AddRow',
/**
* Command handler.
* @param {WysiwygEditor} wwe - WYsiwygEditor instance
* @param {WysiwygEditor} wwe - wysiwygEditor instance
*/
exec(wwe) {
const sq = wwe.getEditor();
Expand Down
2 changes: 1 addition & 1 deletion src/js/extensions/table/mergedTableAlignCol.js
Expand Up @@ -18,7 +18,7 @@ if (CommandManager) {
name: 'AlignCol',
/**
* Command handler.
* @param {WysiwygEditor} wwe - WYsiwygEditor instance
* @param {WysiwygEditor} wwe - wysiwygEditor instance
* @param {string} alignDirection - align direction for table header
*/
exec(wwe, alignDirection) {
Expand Down
2 changes: 1 addition & 1 deletion src/js/extensions/table/mergedTableRemoveCol.js
Expand Up @@ -18,7 +18,7 @@ if (CommandManager) {
name: 'RemoveCol',
/**
* Command handler.
* @param {WysiwygEditor} wwe - WYsiwygEditor instance
* @param {WysiwygEditor} wwe - wysiwygEditor instance
*/
exec(wwe) {
const sq = wwe.getEditor();
Expand Down
2 changes: 1 addition & 1 deletion src/js/extensions/table/mergedTableRemoveRow.js
Expand Up @@ -18,7 +18,7 @@ if (CommandManager) {
name: 'RemoveRow',
/**
* Command handler.
* @param {WysiwygEditor} wwe - WYsiwygEditor instance
* @param {WysiwygEditor} wwe - wysiwygEditor instance
*/
exec(wwe) {
const sq = wwe.getEditor();
Expand Down
2 changes: 1 addition & 1 deletion src/js/extensions/table/unmergeCell.js
Expand Up @@ -18,7 +18,7 @@ if (CommandManager) {
name: 'UnmergeCells',
/**
* Command handler.
* @param {WysiwygEditor} wwe - WYsiwygEditor instance
* @param {WysiwygEditor} wwe - wysiwygEditor instance
*/
exec(wwe) {
const sq = wwe.getEditor();
Expand Down
10 changes: 4 additions & 6 deletions src/js/extensions/table/wwMergedTableManager.js
Expand Up @@ -375,12 +375,10 @@ class WwMergedTableManager extends WwTableManager {
alertMessage = i18n.get('Cannot paste row merged cells into the table header');
updated = false;
} else if (this._isExactlyFit(clipboardTableData, targetRowCount, targetColCount)) {
// data가 clipboard영역에 딱 맞는 경우(배수 포함)

endCellIndex = endRange;
this._updateClipboardTableData(clipboardTableData, targetRowCount, targetColCount);
this._updateTableDataByClipboardData(clipboardTableData, tableData, startRange);
} else if (isSelectionLargerThanData) { // selection이 paste 데이터 보다 큰 경우
} else if (isSelectionLargerThanData) {
endCellIndex = {
rowIndex: startRange.rowIndex + clipboardRowCount - 1,
colIndex: startRange.colIndex + clipboardColCount - 1
Expand All @@ -391,7 +389,7 @@ class WwMergedTableManager extends WwTableManager {
} else {
updated = false;
}
} else { // selection이 paste 데이터 보다 작은 경우
} else { // selected area is smaller then paste data
endCellIndex = {
rowIndex: startRange.rowIndex + targetRowCount - 1,
colIndex: startRange.colIndex + targetColCount - 1
Expand Down Expand Up @@ -526,9 +524,9 @@ class WwMergedTableManager extends WwTableManager {
const tableData = tableDataHandler.createTableData($table);
const startCellIndex = this._findStartCellIndex(tableData, $startCell);

if ($selectedCells.length > 1) { // selection 상태
if ($selectedCells.length > 1) { // selection
this._pasteToSelectedArea($table, clipboardTableData, tableData, $selectedCells);
} else { // cursor 상태
} else { // cursor
this._pasteAllClipboardTableData($table, clipboardTableData, tableData, startCellIndex);
}
}
Expand Down
9 changes: 2 additions & 7 deletions src/js/markdownCommands/blockquote.js
Expand Up @@ -15,14 +15,13 @@ const Blockquote = CommandManager.command('markdown', /** @lends Blockquote */{
name: 'Blockquote',
keyMap: ['CTRL+Q', 'META+Q'],
/**
* 커맨드 핸들러
* @param {MarkdownEditor} mde MarkdownEditor instance
* command handler
* @param {MarkdownEditor} mde MarkdownEditor instance
*/
exec(mde) {
const cm = mde.getEditor();
const doc = cm.getDoc();

// range 을 가공함
const range = mde.getCurrentRange();

const from = {
Expand All @@ -35,18 +34,14 @@ const Blockquote = CommandManager.command('markdown', /** @lends Blockquote */{
ch: doc.getLineHandle(range.to.line).text.length
};

// 영역의 텍스트를 가저오고
const textToModify = doc.getRange(from, to);

// 텍스트 컨텐트를 변경 한다
const textLinesToModify = textToModify.split('\n');
const lineLength = textLinesToModify.length;

for (let i = 0; i < lineLength; i += 1) {
textLinesToModify[i] = `>${textLinesToModify[i]}`;
}

// 해당 에디터의 내용을 변경한다
doc.replaceRange(textLinesToModify.join('\n'), from, to);

range.to.ch += 1;
Expand Down
37 changes: 21 additions & 16 deletions src/js/markdownCommands/bold.js
Expand Up @@ -45,35 +45,39 @@ const Bold = CommandManager.command('markdown', /** @lends Bold */{

cm.focus();
},

/**
* 이미 Bold가 적용이 되어있는지 확인
* @param {string} text 셀렉션텍스트
* @returns {boolean} 볼드 적용 여부
* test it has bold
* @param {string} text - text selected
* @returns {boolean} - true if it has bold
*/
isNeedRemove(text) {
return boldRegex.test(text);
},

/**
* Bold를 적용한다
* @param {string} text 셀렉션텍스트
* @returns {string} 볼드가 적용된 텍스트
* apply bold
* @param {string} text - text selected
* @returns {string} - bold text
*/
append(text) {
return `**${text}**`;
},

/**
* Bold를 제거한다
* @param {string} text 셀렉션텍스트
* @returns {string} 볼드가 제거된 텍스트
* remove bold
* @param {string} text - text selected
* @returns {string} - un-bold text
*/
remove(text) {
return text.substr(2, text.length - 4);
},

/**
* 셀렉션영역을 확장한다
* @param {CodeMirror.doc} doc 코드미러 도큐먼트 객체
* @param {object} cursor 코드미러 커서 객체
* @returns {string} 셀렉션의 텍스트
* expand selection
* @param {CodeMirror.doc} doc - codemirror document
* @param {object} cursor - codemirror cursor
* @returns {string} - text selected
*/
expendSelection(doc, cursor) {
const tmpSelection = doc.getSelection();
Expand All @@ -97,10 +101,11 @@ const Bold = CommandManager.command('markdown', /** @lends Bold */{

return result;
},

/**
* 커서를 센터로 이동시킨다
* @param {CodeMirror.doc} doc 코드미러 도큐먼트 객체
* @param {object} cursor 코드미러 커서 객체
* move cursor to center
* @param {CodeMirror.doc} doc - codemirror document
* @param {object} cursor - codemirror cursor
*/
setCursorToCenter(doc, cursor) {
doc.setCursor(cursor.line, cursor.ch + 2);
Expand Down
6 changes: 3 additions & 3 deletions src/js/markdownCommands/code.js
Expand Up @@ -34,9 +34,9 @@ const Code = CommandManager.command('markdown', /** @lends Code */{
cm.focus();
},
/**
* Code를 적용한다
* @param {string} text 셀렉션텍스트
* @returns {string} 가 적용된 텍스트
* apply Code
* @param {string} text - selected text
* @returns {string} - text after code syntax applied
*/
append(text) {
return `\`${text}\``;
Expand Down

0 comments on commit 848c83c

Please sign in to comment.