@live-change/wysiwyg-frontend 0.2.26 → 0.2.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/front/src/DocumentEditorTest.vue +1 -1
  2. package/front/src/DocumentPreviewTest.vue +1 -1
  3. package/front/src/EditorWithPreview.vue +1 -1
  4. package/front/src/components/DocumentEditor.vue +4 -4
  5. package/front/src/components/Editor.vue +3 -13
  6. package/front/src/components/EditorMenu.vue +15 -0
  7. package/front/src/components/LinkEditor.vue +58 -0
  8. package/front/src/components/TemplatesMenu.vue +1 -1
  9. package/front/src/{components → tiptap}/CodeBlockNode.js +2 -0
  10. package/front/src/{components → tiptap}/CodeBlockView.js +0 -0
  11. package/front/src/{components → tiptap}/ComponentComponent.vue +0 -0
  12. package/front/src/{components → tiptap}/ComponentNode.js +0 -0
  13. package/front/src/{components → tiptap}/ImageComponent.vue +0 -0
  14. package/front/src/{components → tiptap}/ImageNode.js +0 -0
  15. package/front/src/{components → tiptap}/ProseMirrorCollab.js +0 -0
  16. package/front/src/{components → tiptap}/RemoteAuthority.js +0 -0
  17. package/front/src/{components → tiptap}/SlotNode.js +0 -0
  18. package/front/src/tiptap/code-block-node.scss +3 -0
  19. package/front/src/{components → tiptap}/components.js +0 -0
  20. package/front/src/{components → tiptap}/contentConfig.js +6 -1
  21. package/front/src/{components → tiptap}/contentConfigExtensions.js +5 -1
  22. package/front/src/{components → tiptap}/schemaJson.js +1 -1
  23. package/front/src/{components → tiptap}/templates.js +0 -1
  24. package/index.js +9 -6
  25. package/package.json +14 -13
  26. package/server/page.documentType.js +14 -0
  27. package/server/rich.documentType.js +14 -0
@@ -10,7 +10,7 @@
10
10
 
11
11
  import DocumentEditor from "./components/DocumentEditor.vue"
12
12
  import { ref } from 'vue'
13
- import { basicMarks, messageNodes, richEditorNodes, pageNodes } from "./components/contentConfig.js"
13
+ import { basicMarks, messageNodes, richEditorNodes, pageNodes } from "./tiptap/contentConfig.js"
14
14
  import { toRefs } from '@vueuse/core'
15
15
 
16
16
  const props = defineProps({
@@ -14,7 +14,7 @@
14
14
  }
15
15
  })
16
16
 
17
- import { basicMarks, messageNodes, richEditorNodes, pageNodes } from "./components/contentConfig.js"
17
+ import { basicMarks, messageNodes, richEditorNodes, pageNodes } from "./tiptap/contentConfig.js"
18
18
 
19
19
  const contentConfig = {
20
20
  marks: {
@@ -18,7 +18,7 @@
18
18
  import ContentView from "./components/ContentView.js"
19
19
  import Editor from "./components/Editor.vue"
20
20
  import { ref } from 'vue'
21
- import { basicMarks, messageNodes, richEditorNodes } from "./components/contentConfig.js"
21
+ import { basicMarks, messageNodes, richEditorNodes } from "./tiptap/contentConfig.js"
22
22
 
23
23
  const contentConfig = {
24
24
  marks: {
@@ -43,14 +43,14 @@
43
43
  } from 'vue'
44
44
  import { toRefs, useDebounceFn } from '@vueuse/core'
45
45
  import EditorMenu from "./EditorMenu.vue"
46
- import { getExtensions } from "./contentConfigExtensions.js"
47
- import { getSchemaSpecFromConfig, serializeSchema } from "./schemaJson.js"
46
+ import { getExtensions } from "../tiptap/contentConfigExtensions.js"
47
+ import { getSchemaSpecFromConfig, serializeSchema } from "../tiptap/schemaJson.js"
48
48
 
49
49
  import { live, path, useApi, inboxReader } from '@live-change/vue3-ssr'
50
- import ProseMirrorCollab from "./ProseMirrorCollab.js"
50
+ import ProseMirrorCollab from "../tiptap/ProseMirrorCollab.js"
51
51
  import { sendableSteps, receiveTransaction, getVersion } from 'prosemirror-collab'
52
52
  import { Step } from 'prosemirror-transform'
53
- import RemoteAuthority from "./RemoteAuthority";
53
+ import RemoteAuthority from "../tiptap/RemoteAuthority";
54
54
 
55
55
  const props = defineProps({
56
56
  targetType: {
@@ -20,8 +20,8 @@
20
20
  import { ref, computed, watch, provide, defineEmits, defineProps } from 'vue'
21
21
  import { toRefs } from '@vueuse/core'
22
22
  import EditorMenu from "./EditorMenu.vue"
23
- import { getExtensions } from "./contentConfigExtensions.js"
24
- import { getSchemaSpecFromConfig } from "./schemaJson.js"
23
+ import { getExtensions } from "../tiptap/contentConfigExtensions.js"
24
+ import { getSchemaSpecFromConfig } from "../tiptap/schemaJson.js"
25
25
 
26
26
  const props = defineProps({
27
27
  modelValue: {
@@ -94,17 +94,7 @@
94
94
  }
95
95
 
96
96
  pre {
97
- border-radius: 5px;
98
- color: #333;
99
- }
100
-
101
- code {
102
- display: block;
103
- white-space: pre-wrap;
104
- font-size: 0.8rem;
105
- padding: 0.75rem 1rem;
106
- background-color:#e9ecef;
107
- color: #495057;
97
+ overflow-x: auto;
108
98
  }
109
99
 
110
100
  img {
@@ -20,6 +20,10 @@
20
20
  @click="editor.chain().focus().toggleStrike().run()" />
21
21
  </div>
22
22
 
23
+ <Button v-if="config.marks.link" icon="fa-solid fa-link" class="p-button-sm mr-1 mb-1"
24
+ :class="{ 'p-button-outlined': !editor.isActive('link') }"
25
+ @click="openLinkOverlay" />
26
+
23
27
  <div class="p-buttonset mr-1 mb-1">
24
28
  <Button v-if="config.nodes.bulletList" icon="fa-solid fa-list-ul" class="p-button-sm"
25
29
  :class="{ 'p-button-outlined': !editor.isActive('bulletlist') }"
@@ -108,6 +112,10 @@
108
112
  <TemplatesMenu :config="config" @selected="t => handleTemplateSelected(t)" />
109
113
  </OverlayPanel>
110
114
 
115
+ <OverlayPanel ref="linkOverlay">
116
+ <LinkEditor :config="config" :editor="editor" />
117
+ </OverlayPanel>
118
+
111
119
  <!-- <div class="surface-card p-1 shadow-2" style="width: 450px">
112
120
  <h3>components:</h3>
113
121
  <TemplatesMenu :config="config" />
@@ -122,6 +130,8 @@
122
130
  import Dropdown from "primevue/dropdown"
123
131
 
124
132
  import TemplatesMenu from "./TemplatesMenu.vue"
133
+ import LinkEditor from "./LinkEditor.vue"
134
+
125
135
  import { inject, getCurrentInstance, ref, computed } from "vue"
126
136
  import { toRefs } from "@vueuse/core"
127
137
  import { uploadImage } from "@live-change/image-frontend"
@@ -170,6 +180,11 @@
170
180
  //editor.value.chain().focus().setNode('component', { is: component }).run()
171
181
  }
172
182
 
183
+ const linkOverlay = ref()
184
+ function openLinkOverlay(event) {
185
+ linkOverlay.value.show(event)
186
+ }
187
+
173
188
  if(typeof window != 'undefined') window.editor = editor.value
174
189
  </script>
175
190
 
@@ -0,0 +1,58 @@
1
+ <template>
2
+ <div class="flex flex-column w-14rem">
3
+ <div class="mb-2">
4
+ <InputText type="text" v-model="linkData.href" placeholder="Href" class="w-full" />
5
+ </div>
6
+ <div class="flex flex-row flex-grow-1">
7
+ <InputText type="text" v-model="linkData.target" placeholder="target" class="w-full flex-grow-1" />
8
+ <Button v-if="!editor.isActive('link')" @click="addLink"
9
+ icon="pi pi-plus" class="ml-1 flex-shrink-0" label="Add" />
10
+ <Button v-else @click="removeLink"
11
+ icon="pi pi-trash" class="ml-1 flex-shrink-0 p-button-danger" label="Remove" />
12
+ </div>
13
+ </div>
14
+ </template>
15
+
16
+ <script setup>
17
+
18
+ import InputText from "primevue/inputtext"
19
+ import Button from "primevue/button"
20
+
21
+ import { inject, getCurrentInstance, ref, computed, watch } from "vue"
22
+ import { toRefs } from "@vueuse/core"
23
+
24
+ const { editor } = defineProps({
25
+ editor: {
26
+ type: Object,
27
+ required: true
28
+ }
29
+ })
30
+
31
+ const existingLink = editor.getAttributes('link')
32
+
33
+ const linkData = ref({
34
+ href: '',
35
+ target: '_blank',
36
+ ...existingLink
37
+ })
38
+
39
+ watch(linkData, () => {
40
+ if(editor.isActive('link')) {
41
+ editor.chain().setLink(linkData.value).run()
42
+ }
43
+ }, { deep: true })
44
+
45
+ function addLink() {
46
+ editor.chain().setLink(linkData.value).run()
47
+ }
48
+
49
+ function removeLink() {
50
+ editor.chain().unsetLink().run()
51
+ }
52
+
53
+
54
+ </script>
55
+
56
+ <style scoped>
57
+
58
+ </style>
@@ -33,7 +33,7 @@
33
33
  import InputText from "primevue/inputtext"
34
34
 
35
35
  import ContentView from "./ContentView.js"
36
- import templates from "./templates.js"
36
+ import templates from "../tiptap/templates.js"
37
37
 
38
38
  import { ref, computed } from 'vue'
39
39
 
@@ -1,6 +1,8 @@
1
1
  import { Node } from '@tiptap/core'
2
2
  import CodeBlockView from "./CodeBlockView.js"
3
3
 
4
+ import "./code-block-node.scss"
5
+
4
6
  function arrowHandler(dir) {
5
7
  return (state, dispatch, view) => {
6
8
  if (state.selection?.empty && view.endOfTextblock(dir)) {
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ .cm-editor {
2
+ margin: 1em 0px;
3
+ }
File without changes
@@ -8,7 +8,12 @@ export const basicMarks = {
8
8
  bold: (m, c) => h('strong', {}, [ c ]),
9
9
  italic: (m, c) => h('em', {}, [ c ]),
10
10
  underline: (m, c) => h('u', {}, [ c ]),
11
- strike: (m, c) => h('s', {}, [ c ])
11
+ strike: (m, c) => h('s', {}, [ c ]),
12
+ link: (m, c) => h('a', {
13
+ href: m.attrs.href,
14
+ target: m.attrs.target || '_blank',
15
+ rel: 'noopener noreferrer nofollow'
16
+ }, [c]),
12
17
  }
13
18
 
14
19
  export const plainTextNodes = {
@@ -9,6 +9,7 @@ import Blockqoute from "@tiptap/extension-blockquote"
9
9
  import BulletList from "@tiptap/extension-bullet-list"
10
10
  import OrderedList from "@tiptap/extension-ordered-list"
11
11
  import ListItem from "@tiptap/extension-list-item"
12
+ import Link from "@tiptap/extension-link"
12
13
 
13
14
  import Text from '@tiptap/extension-text'
14
15
 
@@ -28,7 +29,10 @@ export const marksExtensions = {
28
29
  bold: [Bold],
29
30
  italic: [Italic],
30
31
  underline: [Underline],
31
- strike: [Strike]
32
+ strike: [Strike],
33
+ link: [Link.configure({
34
+ openOnClick: false,
35
+ })],
32
36
  }
33
37
 
34
38
  export const nodesExtensions = {
@@ -1,5 +1,5 @@
1
1
  import { getSchema } from "@tiptap/core"
2
- import { getExtensions } from "./contentConfigExtensions";
2
+ import { getExtensions } from "./contentConfigExtensions.js";
3
3
 
4
4
  export function schemaTypesMapToObject(map) {
5
5
  let obj = {}
@@ -1,4 +1,3 @@
1
-
2
1
  export function previewContent(component, title) {
3
2
  return [
4
3
  {type: 'heading', attrs:{ level: 3 }, content: [{type: 'text', text: title || component.name }]},
package/index.js CHANGED
@@ -1,17 +1,20 @@
1
- import * as config from './front/src/components/contentConfig.js'
2
- import * as extensions from './front/src/components/contentConfigExtensions.js'
1
+ import * as config from './front/src/tiptap/contentConfig.js'
2
+ import * as extensions from './front/src/tiptap/contentConfigExtensions.js'
3
3
  export { config, extensions }
4
4
 
5
5
  import ContentView from "./front/src/components/ContentView.js"
6
6
  export { ContentView }
7
7
 
8
+ import ImageComponent from "./front/src/tiptap/ImageComponent.vue"
9
+ import ImageNode from "./front/src/tiptap/ImageNode.js"
10
+ import components from "./front/src/tiptap/components.js"
11
+
12
+ export { ImageComponent, ImageNode }
13
+
8
14
  import DocumentEditor from "./front/src/components/DocumentEditor.vue"
9
15
  import Editor from "./front/src/components/Editor.vue"
10
16
  import EditorMenu from "./front/src/components/EditorMenu.vue"
11
- import ImageComponent from "./front/src/components/ImageComponent.vue"
12
- import ImageNode from "./front/src/components/ImageNode.js"
13
- export { DocumentEditor, Editor, EditorMenu, ImageComponent, ImageNode }
14
17
 
15
- import components from "./front/src/components/components.js"
18
+ export { DocumentEditor, Editor, EditorMenu }
16
19
 
17
20
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/wysiwyg-frontend",
3
- "version": "0.2.26",
3
+ "version": "0.2.28",
4
4
  "scripts": {
5
5
  "memDev": "lcli memDev --enableSessions --initScript ./init.js --dbAccess",
6
6
  "localDevInit": "rm tmp.db; lcli localDev --enableSessions --initScript ./init.js",
@@ -25,16 +25,16 @@
25
25
  "@codemirror/language": "^6.1.2",
26
26
  "@codemirror/view": "^6.7.1",
27
27
  "@fortawesome/fontawesome-free": "^6.2.0",
28
- "@live-change/cli": "0.7.10",
29
- "@live-change/dao": "0.5.8",
30
- "@live-change/dao-vue3": "0.5.8",
31
- "@live-change/dao-websocket": "0.5.8",
32
- "@live-change/framework": "0.7.10",
33
- "@live-change/password-authentication-service": "0.3.11",
34
- "@live-change/prosemirror-service": "0.3.11",
35
- "@live-change/secret-code-service": "0.3.11",
36
- "@live-change/secret-link-service": "0.3.11",
37
- "@live-change/session-service": "0.3.11",
28
+ "@live-change/cli": "0.7.11",
29
+ "@live-change/dao": "0.5.9",
30
+ "@live-change/dao-vue3": "0.5.9",
31
+ "@live-change/dao-websocket": "0.5.9",
32
+ "@live-change/framework": "0.7.11",
33
+ "@live-change/password-authentication-service": "0.3.12",
34
+ "@live-change/prosemirror-service": "0.3.12",
35
+ "@live-change/secret-code-service": "0.3.12",
36
+ "@live-change/secret-link-service": "0.3.12",
37
+ "@live-change/session-service": "0.3.12",
38
38
  "@live-change/vue3-components": "0.2.16",
39
39
  "@live-change/vue3-ssr": "0.2.16",
40
40
  "@tiptap/core": "^2.0.0-beta.205",
@@ -52,6 +52,7 @@
52
52
  "@tiptap/extension-history": "^2.0.0-beta.205",
53
53
  "@tiptap/extension-horizontal-rule": "^2.0.0-beta.205",
54
54
  "@tiptap/extension-italic": "^2.0.0-beta.205",
55
+ "@tiptap/extension-link": "2.0.0-beta.209",
55
56
  "@tiptap/extension-list-item": "^2.0.0-beta.205",
56
57
  "@tiptap/extension-ordered-list": "^2.0.0-beta.205",
57
58
  "@tiptap/extension-paragraph": "^2.0.0-beta.205",
@@ -88,7 +89,7 @@
88
89
  "vue3-scroll-border": "0.1.4"
89
90
  },
90
91
  "devDependencies": {
91
- "@live-change/codeceptjs-helper": "0.7.10",
92
+ "@live-change/codeceptjs-helper": "0.7.11",
92
93
  "@wdio/selenium-standalone-service": "^7.20.8",
93
94
  "codeceptjs": "^3.3.4",
94
95
  "generate-password": "1.7.0",
@@ -100,5 +101,5 @@
100
101
  "author": "",
101
102
  "license": "ISC",
102
103
  "description": "",
103
- "gitHead": "6a0d7e0355b05d54ee98d0df558ae87ae3e48f18"
104
+ "gitHead": "c38ec9339a0a830bdf18ef717177ef1c7163be14"
104
105
  }
@@ -1,5 +1,19 @@
1
1
  module.exports = {
2
2
  "marks": {
3
+ "link": {
4
+ "inclusive": true,
5
+ "attrs": {
6
+ "href": {
7
+ "default": null
8
+ },
9
+ "target": {
10
+ "default": "_blank"
11
+ },
12
+ "class": {
13
+ "default": null
14
+ }
15
+ }
16
+ },
3
17
  "bold": {},
4
18
  "italic": {},
5
19
  "underline": {},
@@ -1,5 +1,19 @@
1
1
  module.exports = {
2
2
  "marks": {
3
+ "link": {
4
+ "inclusive": true,
5
+ "attrs": {
6
+ "href": {
7
+ "default": null
8
+ },
9
+ "target": {
10
+ "default": "_blank"
11
+ },
12
+ "class": {
13
+ "default": null
14
+ }
15
+ }
16
+ },
3
17
  "bold": {},
4
18
  "italic": {},
5
19
  "underline": {},