base-ui
Version:
A component library for Better Vue developmemt
18 lines (14 loc) • 391 B
JavaScript
/**
* @author panezhang
* @date 2018/7/28-16:03
* @file bold
*/
export default {
name: 'bold',
icon: 'b-icon-bold',
insert(selectionText = '') {
if (!selectionText.trim()) return '** bold **';
const matched = selectionText.match(/\*\* (.+) \*\*/);
return matched ? selectionText.replace(matched[0], matched[1]) : `** ${selectionText} **`;
}
};