Skip to content

Commit

Permalink
feat: merge and split cells #17
Browse files Browse the repository at this point in the history
  • Loading branch information
gbicou committed Apr 20, 2023
1 parent 486d987 commit 5e55849
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/icons/merge-cells.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
<path
d="M20 3C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H20ZM11 5H5V10.999H7V9L10 12L7 15V13H5V19H11V17H13V19H19V13H17V15L14 12L17 9V10.999H19V5H13V7H11V5ZM13 13V15H11V13H13ZM13 9V11H11V9H13Z"
></path>
</svg>
</template>
7 changes: 7 additions & 0 deletions src/icons/split-cell.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<template>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
<path
d="M20 3C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H20ZM11 5H5V19H11V15H13V19H19V5H13V9H11V5ZM15 9L18 12L15 15V13H9V15L6 12L9 9V11H15V9Z"
></path>
</svg>
</template>
8 changes: 6 additions & 2 deletions src/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"table_delete_column": "Delete column",
"table_add_row_before": "Add row before",
"table_add_row_after": "Add row after",
"table_delete_row": "Delete row"
"table_delete_row": "Delete row",
"table_merge_cells": "Merge cells",
"table_split_cell": "Split cell"
}
},
"fr": {
Expand All @@ -34,7 +36,9 @@
"table_delete_column": "Supprimer la colonne",
"table_add_row_before": "Ajouter une ligne avant",
"table_add_row_after": "Ajouter une ligne après",
"table_delete_row": "Supprimer la ligne"
"table_delete_row": "Supprimer la ligne",
"table_merge_cells": "Fusionner les cellules",
"table_split_cell": "Diviser la cellule"
}
}
}
22 changes: 22 additions & 0 deletions src/tiptap-editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,26 @@
</v-list-item-icon>
<v-list-item-content><v-text-overflow :text="t(`tiptap.table_delete_row`)" /></v-list-item-content>
</v-list-item>
<v-list-item
clickable
:disabled="!editor.isActive('table')"
@click="editor.chain().focus().mergeCells().run()"
>
<v-list-item-icon>
<icon-merge-cells />
</v-list-item-icon>
<v-list-item-content><v-text-overflow :text="t(`tiptap.table_merge_cells`)" /></v-list-item-content>
</v-list-item>
<v-list-item
clickable
:disabled="!editor.isActive('table')"
@click="editor.chain().focus().splitCell().run()"
>
<v-list-item-icon>
<icon-split-cell />
</v-list-item-icon>
<v-list-item-content><v-text-overflow :text="t(`tiptap.table_split_cell`)" /></v-list-item-content>
</v-list-item>
<v-list-item
clickable
:disabled="!editor.isActive('table')"
Expand Down Expand Up @@ -813,6 +833,8 @@ import IconInsertRowTop from "./icons/insert-row-top.vue";
import IconInsertRowBottom from "./icons/insert-row-bottom.vue";
import IconDeleteRow from "./icons/delete-row.vue";
import IconDeleteBin from "./icons/delete-bin.vue";
import IconMergeCells from "./icons/merge-cells.vue";
import IconSplitCell from "./icons/split-cell.vue";
const { t } = useI18n({ messages });
Expand Down

0 comments on commit 5e55849

Please sign in to comment.