-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: - 增加 tab - 修改 b-button size-sm 的 font-weight Test Plan: none Reviewers: #web_reviewers, panezhang Reviewed By: #web_reviewers, panezhang Subscribers: panezhang Differential Revision: https://code.yangqianguan.com/D50117
- Loading branch information
yutiangan
committed
Oct 10, 2018
1 parent
eedc95d
commit 5701252
Showing
6 changed files
with
51 additions
and
5 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* @author yutiangan | ||
* @date 2018/10/10-13:32 | ||
* @file tab | ||
*/ | ||
|
||
export default { | ||
name: 'tab', | ||
|
||
modify({text, selectionStart, selectionEnd}) { | ||
const lineFirstCharIndex = text.lastIndexOf('\n', selectionStart - 1) + 1; | ||
const selectionText = text.slice(selectionStart, selectionEnd); | ||
|
||
let newText; | ||
if (selectionStart === selectionEnd) { | ||
newText = `${text.slice(0, selectionStart)} ${text.slice(selectionStart)}`; | ||
} else { | ||
newText = `${text.slice(0, lineFirstCharIndex) | ||
} ${text.slice(lineFirstCharIndex, selectionStart) | ||
}${selectionText.replace(/\n/g, '\n ')}${text.slice(selectionEnd)}`; | ||
} | ||
|
||
const lengthRevise = newText.length - text.length; | ||
return { | ||
text: newText, | ||
selectionStart: selectionStart + 4, | ||
selectionEnd: selectionEnd + lengthRevise | ||
}; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters