Skip to content

Commit

Permalink
Prepare for release 1
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobFitzp committed Sep 11, 2024
1 parent 2681336 commit a35cbfe
Show file tree
Hide file tree
Showing 11 changed files with 155 additions and 85,690 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,10 @@ composer require jacobfitzp/nova-canvas
Canvas::make('Content')
```

[Read our full documentation here](https://jacobfitzp.github.io/nova-canvas-docs/about.html)
[Read full documentation here](https://jacobfitzp.github.io/nova-canvas-docs/about.html)

## Contribution

We are looking for contributors to help improve and maintain this package.

### Bugs

Feel free to open PR's to address bugs, or to perform general maintenance.
Expand Down
20 changes: 1 addition & 19 deletions dist/css/field.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

85,649 changes: 2 additions & 85,647 deletions dist/js/field.js

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions dist/js/field.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
*/

/*!
* vuex v4.1.0
* (c) 2022 Evan You
* @license MIT
*/

/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@tiptap/extension-character-count": "^2.4.0",
"@tiptap/extension-code-block-lowlight": "^2.4.0",
"@tiptap/extension-dropcursor": "^2.5.7",
"@tiptap/extension-link": "^2.5.8",
"@tiptap/extension-placeholder": "^2.4.0",
"@tiptap/extension-table": "^2.4.0",
"@tiptap/extension-table-cell": "^2.4.0",
Expand All @@ -37,7 +38,9 @@
"@tiptap/pm": "^2.4.0",
"@tiptap/starter-kit": "^2.4.0",
"@tiptap/vue-3": "^2.4.0",
"laravel-nova-ui": "^0.4.12",
"lowlight": "^3.1.0",
"tippy.js": "^6.3.7",
"tiptap-extension-upload-image": "^1.0.1"
}
}
53 changes: 34 additions & 19 deletions resources/js/components/Modals/InsertLink.vue
Original file line number Diff line number Diff line change
@@ -1,45 +1,60 @@
<template>
<Modal :show="true">
<form
@submit.prevent="$emit('confirm')"
class="mx-auto bg-white dark:bg-gray-800 rounded-lg shadow-lg overflow-hidden"
>
<div class="mx-auto bg-white dark:bg-gray-800 rounded-lg shadow-lg overflow-hidden">
<slot>
<ModalHeader>
Insert link
</ModalHeader>
<ModalContent>
<input
class="form-control form-input form-control-bordered"
/>
<Input v-model="link" placeholder="https://example.com" />
</ModalContent>
</slot>

<ModalFooter>
<div class="ml-auto">
<link-button
<div>
<Button
v-if="value.length > 0"
@click="this.$emit('remove')"
type="button"
@click.prevent="this.$emit('close')"
state="danger"
class="mr-3"
>
Cancel
</link-button>

<Button ref="confirmButton" type="submit">
Link
Remove
</Button>

<Button
@click="this.$emit('confirm', link)"
type="button"
>
Save
</Button>

<link-button @click.prevent="this.$emit('cancel')" class="ml-auto">
Cancel
</link-button>
</div>
</ModalFooter>
</form>
</div>
</Modal>
</template>

<script>
import { Button } from 'laravel-nova-ui'
import { Button, Input } from 'laravel-nova-ui'
export default {
emits: ["close", "confirm"],
components: { Button },
emits: ['cancel', 'remove', 'confirm'],
components: { Input, Button },
props: {
value: {
type: String,
default: ''
}
},
data () {
return {
link: this.value
}
}
};
</script>
76 changes: 76 additions & 0 deletions resources/js/components/Tools/Link.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<template>
<button
type="button"
class="hover:text-primary-600 disabled:opacity-50"
:class="{ 'text-primary-600': isActive }"
@click="openModal"
>
<LinkIcon class="h-5 w-5" />
</button>

<InsertLink
v-if="insertingLink"
:value="currentLink"
@confirm="insertLink"
@remove="removeLink"
@cancel="insertingLink = false"
/>
</template>

<script>
import tippy from 'tippy.js'
import BaseTool from './BaseTool'
import { LinkIcon } from '@heroicons/vue/24/outline'
import InsertLink from '../Modals/InsertLink.vue'
export default {
extends: BaseTool,
components: {
InsertLink,
LinkIcon
},
data () {
return {
insertingLink: false
}
},
computed: {
isActive () {
return this.editor.isActive('link')
},
currentLink () {
return this.editor.getAttributes('link').href
}
},
methods: {
/**
* Open the insert link modal.
*/
openModal () {
this.insertingLink = true
},
/**
* Insert the provided link into the selected text.
*
* @param {String} link
*/
insertLink (link) {
this.editor.chain().focus().extendMarkRange('link').setLink({ href: link }).run()
// Close the insert link modal.
this.insertingLink = false
},
/**
* Remove the currently selected link.
*/
removeLink () {
this.editor.chain().focus().extendMarkRange('link').unsetLink().run()
// Close the insert link modal.
this.insertingLink = false
}
}
}
</script>
3 changes: 3 additions & 0 deletions resources/js/components/Tools/Table.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<template>

</template>
11 changes: 11 additions & 0 deletions resources/js/modules/tools/Link.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import LinkComponent from '../../components/Tools/Link.vue'
import Link from '@tiptap/extension-link'

export default {
component: LinkComponent,
extension () {
return Link.configure({
openOnClick: false
})
}
}
10 changes: 8 additions & 2 deletions resources/js/modules/tools/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@ import { TableRow } from '@tiptap/extension-table-row'
import { TableHeader } from '@tiptap/extension-table-header'
import { TableCell } from '@tiptap/extension-table-cell'


export default {
icon: TableCellsIcon,
component: Standard,
apply (editor) {
editor.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: true }).run()
editor.chain()
.focus()
.insertTable({
rows: 3,
cols: 3,
withHeaderRow: true
})
.run()
},
active (editor) {
return editor.isActive('table')
Expand Down
2 changes: 2 additions & 0 deletions resources/js/modules/tools/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import Image from './Image'
import OrderedList from './OrderedList'
import BulletList from './BulletList'
import Table from './Table'
import Link from './Link'
import Undo from './History/Undo'
import Redo from './History/Redo'

Expand All @@ -37,6 +38,7 @@ export default {
alignRight: AlignRight,
orderedList: OrderedList,
bulletList: BulletList,
link: Link,
undo: Undo,
redo: Redo,
// Visual divider between tools, has a shorthand representation of '|'.
Expand Down

0 comments on commit a35cbfe

Please sign in to comment.