@lowdefy/blocks-tiptap 6.1.0 → 7.0.0

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.
@@ -116,6 +116,7 @@ const TiptapInput = ({ blockId, components: { Icon, Link }, events, loading, met
116
116
  className: wrapperClass,
117
117
  style: wrapperStyle
118
118
  }), !disabled && /*#__PURE__*/ React.createElement(PopoverMenu, {
119
+ blockId: blockId,
119
120
  editor: editor,
120
121
  Icon: Icon
121
122
  }));
@@ -14,7 +14,15 @@
14
14
  limitations under the License.
15
15
  */ export default {
16
16
  category: 'input',
17
- icons: [],
17
+ actions: [
18
+ 'Request'
19
+ ],
20
+ icons: [
21
+ 'bold',
22
+ 'italic',
23
+ 'strikethrough',
24
+ 'highlight'
25
+ ],
18
26
  valueType: 'object',
19
27
  initValue: {
20
28
  html: null,
@@ -91,6 +99,7 @@
91
99
  },
92
100
  image: {
93
101
  type: 'object',
102
+ urlKind: false,
94
103
  description: 'Image extension settings.',
95
104
  additionalProperties: false,
96
105
  properties: {
@@ -13,7 +13,7 @@
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  */ import React, { useEffect } from 'react';
16
- import { withBlockDefaults } from '@lowdefy/block-utils';
16
+ import { getSafeHref, withBlockDefaults } from '@lowdefy/block-utils';
17
17
  import { type } from '@lowdefy/helpers';
18
18
  import { EditorContent } from '@tiptap/react';
19
19
  import { mergeAttributes } from '@tiptap/core';
@@ -121,7 +121,7 @@ const TiptapMentionInput = ({ blockId, components: { Icon, Link }, events, loadi
121
121
  if (!type.isNone(color)) {
122
122
  modifier.style = `color: ${color}`;
123
123
  }
124
- const href = type.isFunction(properties.mentions?.getHref) ? properties.mentions.getHref(id) : undefined;
124
+ const href = type.isFunction(properties.mentions?.getHref) ? getSafeHref(properties.mentions.getHref(id)) : undefined;
125
125
  if (!type.isNone(href)) {
126
126
  return [
127
127
  'a',
@@ -264,6 +264,7 @@ const TiptapMentionInput = ({ blockId, components: { Icon, Link }, events, loadi
264
264
  className: wrapperClass,
265
265
  style: wrapperStyle
266
266
  }), !disabled && /*#__PURE__*/ React.createElement(PopoverMenu, {
267
+ blockId: blockId,
267
268
  editor: editor,
268
269
  Icon: Icon
269
270
  }));
@@ -14,7 +14,15 @@
14
14
  limitations under the License.
15
15
  */ export default {
16
16
  category: 'input',
17
- icons: [],
17
+ actions: [
18
+ 'Request'
19
+ ],
20
+ icons: [
21
+ 'bold',
22
+ 'italic',
23
+ 'strikethrough',
24
+ 'highlight'
25
+ ],
18
26
  valueType: 'object',
19
27
  initValue: {
20
28
  html: null,
@@ -88,6 +96,7 @@
88
96
  },
89
97
  image: {
90
98
  type: 'object',
99
+ urlKind: false,
91
100
  description: 'Image extension settings.',
92
101
  additionalProperties: false,
93
102
  properties: {
@@ -21,7 +21,7 @@ events:
21
21
  type: SetState
22
22
  params:
23
23
  tiptap_mention_with_value:
24
- html: '<p>Hi <span class="tiptap-mention">@Alice</span>.</p>'
24
+ html: '<p>Hi <span data-type="mention" class="tiptap-mention" data-id="user_1" data-label="Alice">@Alice</span>.</p>'
25
25
  tiptap_mention_disabled:
26
26
  html: '<p>Disabled mention editor.</p>'
27
27
  # Saved html round-trip: a mention node comes back with a STRING id
@@ -15,7 +15,6 @@
15
15
  */ import React, { useEffect, useState } from 'react';
16
16
  import { createPortal } from 'react-dom';
17
17
  import { BubbleMenuPlugin } from '@tiptap/extension-bubble-menu';
18
- import { AiOutlineBold, AiOutlineItalic, AiOutlineStrikethrough, AiOutlineHighlight } from 'react-icons/ai';
19
18
  import { isTextSelection } from '@tiptap/core';
20
19
  const HIGHLIGHT_SWATCHES = [
21
20
  {
@@ -81,7 +80,7 @@ function createMenuElements() {
81
80
  // with a portal. React only ever removes the buttons from our content element
82
81
  // (always their parent), never the plugin-managed root, so the teardown race
83
82
  // is gone.
84
- const PopoverMenu = ({ editor })=>{
83
+ const PopoverMenu = ({ blockId, editor, Icon })=>{
85
84
  const [menu] = useState(createMenuElements);
86
85
  const showBold = hasExt(editor, 'bold');
87
86
  const showItalic = hasExt(editor, 'italic');
@@ -125,24 +124,42 @@ const PopoverMenu = ({ editor })=>{
125
124
  hasTools
126
125
  ]);
127
126
  if (!menu || !hasTools) return null;
128
- return /*#__PURE__*/ createPortal(/*#__PURE__*/ React.createElement(React.Fragment, null, showBold && /*#__PURE__*/ React.createElement(AiOutlineBold, {
129
- className: "tiptap-icon",
130
- onClick: ()=>editor.chain().focus().toggleBold().run()
131
- }), showItalic && /*#__PURE__*/ React.createElement(AiOutlineItalic, {
132
- className: "tiptap-icon",
133
- onClick: ()=>editor.chain().focus().toggleItalic().run()
134
- }), showStrike && /*#__PURE__*/ React.createElement(AiOutlineStrikethrough, {
135
- className: "tiptap-icon",
136
- onClick: ()=>editor.chain().focus().toggleStrike().run()
137
- }), showHighlight && HIGHLIGHT_SWATCHES.map(({ color, fill })=>/*#__PURE__*/ React.createElement(AiOutlineHighlight, {
127
+ return /*#__PURE__*/ createPortal(/*#__PURE__*/ React.createElement(React.Fragment, null, showBold && /*#__PURE__*/ React.createElement(Icon, {
128
+ blockId: `${blockId}_bold_icon`,
129
+ classNames: {
130
+ element: 'tiptap-icon'
131
+ },
132
+ onClick: ()=>editor.chain().focus().toggleBold().run(),
133
+ properties: "bold"
134
+ }), showItalic && /*#__PURE__*/ React.createElement(Icon, {
135
+ blockId: `${blockId}_italic_icon`,
136
+ classNames: {
137
+ element: 'tiptap-icon'
138
+ },
139
+ onClick: ()=>editor.chain().focus().toggleItalic().run(),
140
+ properties: "italic"
141
+ }), showStrike && /*#__PURE__*/ React.createElement(Icon, {
142
+ blockId: `${blockId}_strikethrough_icon`,
143
+ classNames: {
144
+ element: 'tiptap-icon'
145
+ },
146
+ onClick: ()=>editor.chain().focus().toggleStrike().run(),
147
+ properties: "strikethrough"
148
+ }), showHighlight && HIGHLIGHT_SWATCHES.map(({ color, fill }, i)=>/*#__PURE__*/ React.createElement(Icon, {
138
149
  key: color,
139
- className: "tiptap-icon",
140
- style: {
141
- color
150
+ blockId: `${blockId}_highlight_${i}_icon`,
151
+ classNames: {
152
+ element: 'tiptap-icon'
153
+ },
154
+ styles: {
155
+ element: {
156
+ color
157
+ }
142
158
  },
143
159
  onClick: ()=>editor.chain().focus().toggleHighlight({
144
160
  color: fill
145
- }).run()
161
+ }).run(),
162
+ properties: "highlight"
146
163
  }))), menu.content);
147
164
  };
148
165
  export default PopoverMenu;
@@ -1,3 +1,19 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
16
+
1
17
  /* Wrapper: the EditorContent div with border/background/focus styling.
2
18
  Antd v6 uses CSS-in-JS so the `.ant-input` class is not a global
3
19
  stylesheet class — we replicate the input look using antd's theme
@@ -261,7 +277,7 @@
261
277
  cursor: pointer;
262
278
  }
263
279
 
264
- .tiptap-icon + .tiptap-icon {
280
+ .tiptap-popover > * + * {
265
281
  margin-left: 4px;
266
282
  }
267
283
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/blocks-tiptap",
3
- "version": "6.1.0",
3
+ "version": "7.0.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Lowdefy TipTap rich-text editor blocks.",
6
6
  "homepage": "https://lowdefy.com",
@@ -35,6 +35,9 @@
35
35
  "url": "https://github.com/lowdefy/lowdefy.git"
36
36
  },
37
37
  "type": "module",
38
+ "sideEffects": [
39
+ "**/*.css"
40
+ ],
38
41
  "exports": {
39
42
  "./*": "./dist/*",
40
43
  "./blocks": "./dist/blocks.js",
@@ -46,10 +49,10 @@
46
49
  "dist/*"
47
50
  ],
48
51
  "dependencies": {
49
- "@lowdefy/block-utils": "6.1.0",
50
- "@lowdefy/blocks-antd": "6.1.0",
51
- "@lowdefy/blocks-files": "6.1.0",
52
- "@lowdefy/helpers": "6.1.0",
52
+ "@lowdefy/block-utils": "7.0.0",
53
+ "@lowdefy/blocks-antd": "7.0.0",
54
+ "@lowdefy/blocks-files": "7.0.0",
55
+ "@lowdefy/helpers": "7.0.0",
53
56
  "@tiptap/core": "3.31.3",
54
57
  "@tiptap/extension-bubble-menu": "3.31.3",
55
58
  "@tiptap/extension-file-handler": "3.31.3",
@@ -63,7 +66,6 @@
63
66
  "@tiptap/react": "3.31.3",
64
67
  "@tiptap/starter-kit": "3.31.3",
65
68
  "@tiptap/suggestion": "3.31.3",
66
- "react-icons": "5.6.0",
67
69
  "tippy.js": "6.3.7",
68
70
  "turndown": "7.2.0"
69
71
  },
@@ -72,8 +74,8 @@
72
74
  "react-dom": ">=18"
73
75
  },
74
76
  "devDependencies": {
75
- "@lowdefy/block-dev-e2e": "6.1.0",
76
- "@lowdefy/e2e-utils": "6.1.0",
77
+ "@lowdefy/block-dev-e2e": "7.0.0",
78
+ "@lowdefy/e2e-utils": "7.0.0",
77
79
  "@playwright/test": "1.59.1",
78
80
  "@swc/cli": "0.8.1",
79
81
  "@swc/core": "1.15.32",