Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
bastihilger committed Jun 7, 2021
1 parent 0e46697 commit 578d6f9
Show file tree
Hide file tree
Showing 22 changed files with 790 additions and 791 deletions.
2 changes: 1 addition & 1 deletion dist/js/field.js

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions jsconfig.json

This file was deleted.

17 changes: 16 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,41 @@
"resolve-url-loader": "^3.1.0",
"sass": "^1.26.10",
"sass-loader": "^8.0.2",
"ts-loader": "^9.2.3",
"typescript": "^4.3.2",
"vue-loader": "^15.9.5"
},
"dependencies": {
"@tiptap/core": "^2.0.0-beta.80",
"@tiptap/extension-blockquote": "^2.0.0-beta.13",
"@tiptap/extension-bold": "^2.0.0-beta.13",
"@tiptap/extension-bullet-list": "^2.0.0-beta.13",
"@tiptap/extension-code": "^2.0.0-beta.13",
"@tiptap/extension-code-block-lowlight": "^2.0.0-beta.12",
"@tiptap/extension-document": "^2.0.0-beta.12",
"@tiptap/extension-dropcursor": "^2.0.0-beta.14",
"@tiptap/extension-gapcursor": "^2.0.0-beta.15",
"@tiptap/extension-hard-break": "^2.0.0-beta.6",
"@tiptap/extension-heading": "^2.0.0-beta.13",
"@tiptap/extension-highlight": "^2.0.0-beta.6",
"@tiptap/extension-history": "^2.0.0-beta.12",
"@tiptap/extension-horizontal-rule": "^2.0.0-beta.16",
"@tiptap/extension-image": "^2.0.0-beta.13",
"@tiptap/extension-italic": "^2.0.0-beta.13",
"@tiptap/extension-link": "^2.0.0-beta.8",
"@tiptap/extension-list-item": "^2.0.0-beta.13",
"@tiptap/extension-ordered-list": "^2.0.0-beta.13",
"@tiptap/extension-paragraph": "^2.0.0-beta.14",
"@tiptap/extension-placeholder": "^2.0.0-beta.19",
"@tiptap/extension-strike": "^2.0.0-beta.15",
"@tiptap/extension-table": "^2.0.0-beta.18",
"@tiptap/extension-table-cell": "^2.0.0-beta.11",
"@tiptap/extension-table-header": "^2.0.0-beta.13",
"@tiptap/extension-table-row": "^2.0.0-beta.11",
"@tiptap/extension-text": "^2.0.0-beta.12",
"@tiptap/extension-text-align": "^2.0.0-beta.17",
"@tiptap/extension-text-style": "^2.0.0-beta.6",
"@tiptap/extension-underline": "^2.0.0-beta.7",
"@tiptap/starter-kit": "^2.0.0-beta.37",
"@tiptap/vue-2": "^2.0.0-beta.23",
"axios": "^0.21.1",
"i": "^0.3.6",
Expand Down
67 changes: 40 additions & 27 deletions resources/js/components/FormField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
:button="button"
:field="field"
:mode="mode"
:fileDisk="fileDisk"
:filePath="filePath"
>
</link-button>
</template>
Expand Down Expand Up @@ -84,22 +86,15 @@
</template>

<template v-else-if="button == 'editHtml'">
<button
:title="button"
type="button"
class="
btn btn-default p-1 leading-none
text-xs min-w-8 h-8 m-1 tiptap-button
"
:class="[
(mode == 'html' ? 'btn-primary' : 'bg-white hover:bg-20'),
'is-' + button
]"
@click="switchMode()"
<base-button
:isActive="mode == 'html'"
:clickMethod="switchMode"
:icon="['fas', 'file-code']"
:title="__('edit html')"
>
<font-awesome-icon v-if="button == 'editHtml'" :icon="['fas', 'file-code']">
</font-awesome-icon>
</button>

</base-button>

</template>

<template v-else>
Expand Down Expand Up @@ -198,6 +193,8 @@ import TextAlignButtons from './buttons/TextAlignButtons';
import HistoryButtons from './buttons/HistoryButtons';
import ImageButton from './buttons/ImageButton';
import BaseButton from './buttons/BaseButton.vue';
import CodeBlockComponent from './CodeBlockComponent';
import EditHtml from './EditHtml';
Expand All @@ -206,23 +203,16 @@ import Gapcursor from '@tiptap/extension-gapcursor';
import lowlight from 'lowlight';
import pretty from 'pretty';
import { FormField, HandlesValidationErrors } from 'laravel-nova';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
import { library } from '@fortawesome/fontawesome-svg-core';
import { faFileCode } from '@fortawesome/free-solid-svg-icons';
import buttonHovers from '../mixins/buttonHovers';
library.add(faFileCode);
import { FormField, HandlesValidationErrors } from 'laravel-nova';
export default {
mixins: [FormField, HandlesValidationErrors],
mixins: [FormField, HandlesValidationErrors, buttonHovers],
props: ['resourceName', 'resourceId', 'field'],
components: {
FontAwesomeIcon,
EditorContent,
LinkButton,
NormalButton,
Expand All @@ -232,7 +222,7 @@ export default {
HistoryButtons,
ImageButton,
EditHtml,
BaseButton,
},
data() {
Expand All @@ -243,6 +233,8 @@ export default {
placeholder: '',
imageDisk: '',
imagePath: '',
fileDisk: '',
filePath: '',
}
},
Expand Down Expand Up @@ -317,6 +309,12 @@ export default {
if (this.field.imageSettings && this.field.imageSettings.disk) {
this.imageDisk = this.field.imageSettings.disk;
}
if (this.field.fileSettings && this.field.fileSettings.path) {
this.filePath = this.field.fileSettings.path;
}
if (this.field.fileSettings && this.field.fileSettings.disk) {
this.fileDisk = this.field.fileSettings.disk;
}
Expand All @@ -326,7 +324,22 @@ export default {
Code,
Italic,
Highlight,
Link,
Link.extend({
addAttributes() {
return {
...this.parent?.(),
'tt-mode': {
default: 'url',
},
class: {
default: '',
},
title: {
default: '',
},
}
}
}),
Strike,
TextStyle,
Underline,
Expand Down
Loading

0 comments on commit 578d6f9

Please sign in to comment.