Skip to content

Commit

Permalink
feat: ✨ add SelectAll extension
Browse files Browse the repository at this point in the history
  • Loading branch information
Leecason committed Mar 9, 2020
1 parent ede119e commit 1054270
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/components/MenuCommands/CommandButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import 'vue-awesome/icons/expand';
import 'vue-awesome/icons/compress';
import 'vue-awesome/icons/print';
import 'vue-awesome/icons/eye';
import 'vue-awesome/icons/regular/object-group';
import { Component, Prop, Vue } from 'vue-property-decorator';
import { Tooltip } from 'element-ui';
Expand Down
1 change: 1 addition & 0 deletions src/extensions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ export { default as FormatClear } from './format_clear';
export { default as Fullscreen } from './fullscreen';
export { default as Print } from './print';
export { default as Preview } from './preview';
export { default as SelectAll } from './select_all';
27 changes: 27 additions & 0 deletions src/extensions/select_all.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { selectAll } from 'prosemirror-commands';
import { Extension, MenuData } from 'tiptap';
import { CommandFunction } from 'tiptap-commands';
import { MenuBtnView } from '@/../types';
import { t } from '@/i18n/index';
import CommandButton from '@/components/MenuCommands/CommandButton.vue';

export default class SelectAll extends Extension implements MenuBtnView {
get name () {
return 'select_all';
}

commands () {
return (): CommandFunction => selectAll;
}

menuBtnView ({ commands }: MenuData) {
return {
component: CommandButton,
componentProps: {
command: commands.select_all,
icon: 'regular/object-group',
tooltip: t('editor.extensions.SelectAll.tooltip'),
},
};
}
}
3 changes: 3 additions & 0 deletions src/i18n/en/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ export default {
title: 'Preview',
},
},
SelectAll: {
tooltip: 'Select all',
},
},
characters: 'Characters',
},
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/pl/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ export default {
title: 'Podgląd',
},
},
SelectAll: {
tooltip: 'Zaznacz wszystko',
},
},
characters: 'Postać',
},
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/zh/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ export default {
title: '预览',
},
},
SelectAll: {
tooltip: '全选',
},
},
characters: '字数',
},
Expand Down

0 comments on commit 1054270

Please sign in to comment.