fix(fluent-editor): fix better-table (#1788)

This commit is contained in:
Kagol 2024-07-29 19:43:39 +08:00 committed by GitHub
parent 73316081d0
commit e596b50027
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 59 additions and 9 deletions

View File

@ -118,3 +118,45 @@ export const ICONS_CONFIG: { [key: string]: any } = {
help: HELP_ICON,
screenshot: SCREENSHOT_ICON,
}
export const TABLE_RIGHT_MENU_CONFIG = {
copyCells: {
text: LANG_CONF['copy-cells']
},
copyTable: {
text: LANG_CONF['copy-table']
},
cutCells: {
text: LANG_CONF['cut-cells']
},
emptyCells: {
text: LANG_CONF['empty-cells']
},
insertRowUp: {
text: LANG_CONF['insert-row-up']
},
insertRowDown: {
text: LANG_CONF['insert-row-down']
},
insertColumnLeft: {
text: LANG_CONF['insert-column-left']
},
insertColumnRight: {
text: LANG_CONF['insert-column-right']
},
mergeCells: {
text: LANG_CONF['merge-cells']
},
unMergeCells: {
text: LANG_CONF['unmerge-cells']
},
deleteRow: {
text: LANG_CONF['delete-row']
},
deleteColumn: {
text: LANG_CONF['delete-column']
},
deleteTable: {
text: LANG_CONF['delete-table']
}
};

View File

@ -1,5 +1,5 @@
import Quill from 'quill'
import { FONT_FAMILY_CONFIG, FONT_SIZE_CONFIG, ICONS_CONFIG } from './config'
import { FONT_FAMILY_CONFIG, FONT_SIZE_CONFIG, ICONS_CONFIG, TABLE_RIGHT_MENU_CONFIG } from './config'
import Counter from './counter' // 字符统计
import CustomClipboard from './custom-clipboard' // 粘贴板
import CustomImage from './custom-image/BlotFormatter' // 图片
@ -45,6 +45,15 @@ const registerModules = function () {
redo() {
this.quill.history.redo()
},
'better-table': function() {
this.quill.getModule('better-table').insertTable(3, 3)
},
}
},
'better-table': {
operationMenu: {
items: TABLE_RIGHT_MENU_CONFIG,
color: true
}
}
}

View File

@ -42,13 +42,12 @@ const MENU_ITEMS_DEFAULT = {
dom.remove();
}
},
// tofix
// cutCells: {
// text: 'Cut Cells',
// handler() {
// this.onCopy('cut');
// }
// },
cutCells: {
text: 'Cut Cells',
handler() {
this.onCopy('cut');
}
},
emptyCells: {
text: 'Empty Cells',
handler() {
@ -207,7 +206,7 @@ const MENU_ITEMS_DEFAULT = {
}
},
unmergeCells: {
unMergeCells: {
text: 'Split Cells',
handler() {
const tableContainer = Quill.find(this.table);