-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
75fa6c0
commit 6442677
Showing
8 changed files
with
303 additions
and
1 deletion.
There are no files selected for viewing
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
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,48 @@ | ||
import { Table as TableOriginal } from 'tiptap-extensions' | ||
import { VuetifyIconsGroups } from '~/configs/theme' | ||
import VuetifyIcon from '~/extensions/nativeExtensions/icons/VuetifyIcon' | ||
import AbstractExtension from '~/extensions/AbstractExtension' | ||
import ExtensionActionInterface from '~/extensions/actions/ExtensionActionInterface' | ||
import Vue from 'vue' | ||
import ExtensionActionRenderBtn from '~/extensions/actions/renders/btn/ExtensionActionRenderBtn.ts' | ||
import TableWindow from '~/extensions/nativeExtensions/table/TableWindow.vue' | ||
|
||
export default class Table extends AbstractExtension { | ||
constructor (options) { | ||
super(options, TableOriginal) | ||
} | ||
|
||
get availableActions (): ExtensionActionInterface[] { | ||
const nativeExtensionName = 'table' | ||
|
||
return [ | ||
{ | ||
render: new ExtensionActionRenderBtn({ | ||
tooltip: 'TODO', | ||
icons: { | ||
[VuetifyIconsGroups.md]: new VuetifyIcon('table'), | ||
[VuetifyIconsGroups.fa]: new VuetifyIcon('fas fa-table'), | ||
[VuetifyIconsGroups.mdi]: new VuetifyIcon('mdi-table'), | ||
[VuetifyIconsGroups.mdiSvg]: new VuetifyIcon('M8.5,13.5L11,16.5L14.5,12L19,18H5M21,19V5C21,3.89 20.1,3 19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19Z') | ||
}, | ||
nativeExtensionName, | ||
async onClick ({ context, editor }) { | ||
const WindowComponent = Vue.extend(TableWindow) | ||
const instance = new WindowComponent({ | ||
vuetify: Vue.prototype.tiptapVuetifyPlugin.vuetify, | ||
propsData: { | ||
value: true, | ||
nativeExtensionName, | ||
context, | ||
editor | ||
} | ||
}) | ||
|
||
instance.$mount() | ||
document.querySelector('body')!.appendChild(instance.$el) | ||
} | ||
}) | ||
} | ||
] | ||
} | ||
} |
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,13 @@ | ||
import { TableCell as TableCellOriginal } from 'tiptap-extensions' | ||
import ExtensionActionInterface from '~/extensions/actions/ExtensionActionInterface' | ||
import AbstractExtension from '~/extensions/AbstractExtension' | ||
|
||
export default class TableCell extends AbstractExtension { | ||
constructor (options) { | ||
super(options, TableCellOriginal) | ||
} | ||
|
||
get availableActions (): ExtensionActionInterface[] { | ||
return [] | ||
} | ||
} |
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,13 @@ | ||
import { TableHeader as TableHeaderOriginal } from 'tiptap-extensions' | ||
import ExtensionActionInterface from '~/extensions/actions/ExtensionActionInterface' | ||
import AbstractExtension from '~/extensions/AbstractExtension' | ||
|
||
export default class TableHeader extends AbstractExtension { | ||
constructor (options) { | ||
super(options, TableHeaderOriginal) | ||
} | ||
|
||
get availableActions (): ExtensionActionInterface[] { | ||
return [] | ||
} | ||
} |
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,13 @@ | ||
import { TableRow as TableRowOriginal } from 'tiptap-extensions' | ||
import ExtensionActionInterface from '~/extensions/actions/ExtensionActionInterface' | ||
import AbstractExtension from '~/extensions/AbstractExtension' | ||
|
||
export default class TableRow extends AbstractExtension { | ||
constructor (options) { | ||
super(options, TableRowOriginal) | ||
} | ||
|
||
get availableActions (): ExtensionActionInterface[] { | ||
return [] | ||
} | ||
} |
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,140 @@ | ||
<template> | ||
<v-dialog | ||
:value="value" | ||
max-width="500px" | ||
> | ||
<v-card> | ||
<v-card-title> | ||
<span class="headline"> | ||
Tables | ||
</span> | ||
|
||
<v-spacer /> | ||
|
||
<v-btn | ||
icon | ||
@click="close" | ||
> | ||
<v-icon>{{ COMMON_ICONS.close[$tiptapVuetify.iconsGroup] }}</v-icon> | ||
</v-btn> | ||
</v-card-title> | ||
<v-card-text> | ||
<v-text-field | ||
v-model="form.rowsCount" | ||
label="Rows count" | ||
/> | ||
<v-text-field | ||
v-model="form.colsCount" | ||
label="Cols count" | ||
/> | ||
<v-checkbox | ||
v-model="form.withHeaderRow" | ||
label="With header row" | ||
/> | ||
</v-card-text> | ||
<v-card-actions> | ||
<v-btn | ||
text | ||
@click="close" | ||
> | ||
Close | ||
</v-btn> | ||
|
||
<v-btn | ||
text | ||
@click="apply" | ||
> | ||
Apply | ||
</v-btn> | ||
</v-card-actions> | ||
</v-card> | ||
</v-dialog> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { mixins } from 'vue-class-component' | ||
import { Component, Prop } from 'vue-property-decorator' | ||
import { | ||
VRow, | ||
VCol, | ||
VDialog, | ||
VCard, | ||
VCardTitle, | ||
VCardText, | ||
VCardActions, | ||
VBtn, | ||
VSpacer, | ||
VIcon, | ||
VTextField, | ||
VCheckbox | ||
} from 'vuetify/lib' | ||
import I18nMixin from '~/mixins/I18nMixin' | ||
import { COMMON_ICONS } from '~/configs/theme' | ||
export const PROPS = { | ||
VALUE: 'value' as const, | ||
CONTEXT: 'context' as const, | ||
EDITOR: 'editor' as const, | ||
IMAGE_SOURCES: 'imageSources' as const, | ||
IMAGE_SOURCES_OVERRIDE: 'imageSourcesOverride' as const, | ||
NATIVE_EXTENSION_NAME: 'nativeExtensionName' as const | ||
} | ||
@Component({ | ||
components: { VRow, VCol, VDialog, VCard, VCardTitle, VCardText, VCardActions, VBtn, VSpacer, VIcon, VTextField, VCheckbox } | ||
}) | ||
export default class TableWindow extends mixins(I18nMixin) { | ||
@Prop({ | ||
type: Boolean, | ||
default: false | ||
}) | ||
readonly [PROPS.VALUE]: boolean | ||
@Prop({ | ||
type: String, | ||
required: true | ||
}) | ||
readonly [PROPS.NATIVE_EXTENSION_NAME]: string | ||
@Prop({ | ||
type: Object, | ||
required: true | ||
}) | ||
readonly [PROPS.CONTEXT]: any | ||
@Prop({ | ||
type: Object, | ||
required: true | ||
}) | ||
readonly [PROPS.EDITOR]: any | ||
@Prop({ | ||
type: Boolean, | ||
required: false | ||
}) | ||
readonly [PROPS.IMAGE_SOURCES_OVERRIDE]: any | ||
readonly COMMON_ICONS = COMMON_ICONS | ||
form = { | ||
rowsCount: 2, | ||
colsCount: 3, | ||
withHeaderRow: false | ||
} | ||
apply () { | ||
this[PROPS.CONTEXT].commands.createTable({ | ||
rowsCount: this.form.rowsCount, | ||
colsCount: this.form.colsCount, | ||
withHeaderRow: this.form.withHeaderRow | ||
}) | ||
this.close() | ||
this[PROPS.EDITOR].focus() | ||
} | ||
close () { | ||
this.$destroy() | ||
this.$el.parentNode!.removeChild(this.$el) | ||
} | ||
} | ||
</script> |