@djangocfg/widget-editor 0.1.1 → 0.1.3
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.
- package/package.json +8 -7
- package/src/link-preview/LinkPreviewCard.tsx +0 -3
- package/src/markdown/MarkdownEditor.tsx +0 -2
- package/src/markdown/chip/ChipNode.ts +1 -2
- package/src/markdown/mentionPresets.ts +1 -1
- package/src/markdown/slash/SlashCommandNode.ts +0 -1
- package/src/notion/SlashExtension.ts +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/widget-editor",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "TipTap editors: a markdown field with mentions and chips, and a Notion-style block editor with slash commands, tables and embedded blocks",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"editor",
|
|
@@ -66,13 +66,14 @@
|
|
|
66
66
|
"scripts": {
|
|
67
67
|
"check": "tsc --noEmit",
|
|
68
68
|
"check-types": "tsc --noEmit",
|
|
69
|
+
"lint": "eslint .",
|
|
69
70
|
"test": "vitest run",
|
|
70
71
|
"test:watch": "vitest"
|
|
71
72
|
},
|
|
72
73
|
"dependencies": {
|
|
73
|
-
"@djangocfg/widget-data": "^0.1.
|
|
74
|
-
"@djangocfg/widget-kit": "^0.1.
|
|
75
|
-
"@djangocfg/widget-map": "^0.1.
|
|
74
|
+
"@djangocfg/widget-data": "^0.1.3",
|
|
75
|
+
"@djangocfg/widget-kit": "^0.1.3",
|
|
76
|
+
"@djangocfg/widget-map": "^0.1.3",
|
|
76
77
|
"@floating-ui/dom": "^1.8.0",
|
|
77
78
|
"@tiptap/core": "^3.27.3",
|
|
78
79
|
"@tiptap/extension-code-block-lowlight": "^3.27.3",
|
|
@@ -94,15 +95,15 @@
|
|
|
94
95
|
"tiptap-extension-global-drag-handle": "^0.1.18"
|
|
95
96
|
},
|
|
96
97
|
"peerDependencies": {
|
|
97
|
-
"@djangocfg/ui-core": "^2.1.
|
|
98
|
+
"@djangocfg/ui-core": "^2.1.544",
|
|
98
99
|
"lucide-react": "^0.545.0",
|
|
99
100
|
"react": "^19.0.0",
|
|
100
101
|
"react-dom": "^19.0.0",
|
|
101
102
|
"zod": "^4.3.6"
|
|
102
103
|
},
|
|
103
104
|
"devDependencies": {
|
|
104
|
-
"@djangocfg/typescript-config": "^2.1.
|
|
105
|
-
"@djangocfg/ui-core": "^2.1.
|
|
105
|
+
"@djangocfg/typescript-config": "^2.1.544",
|
|
106
|
+
"@djangocfg/ui-core": "^2.1.544",
|
|
106
107
|
"@storybook/react-vite": "^10.5.0",
|
|
107
108
|
"@types/node": "^25.9.5",
|
|
108
109
|
"@types/react": "19.2.15",
|
|
@@ -125,7 +125,6 @@ export function LinkPreviewCard({
|
|
|
125
125
|
<a href={url} target="_blank" rel="noopener noreferrer" className={frame}>
|
|
126
126
|
{/* Cover image (full appearance, when present) — top banner. */}
|
|
127
127
|
{isFull && meta.image ? (
|
|
128
|
-
// eslint-disable-next-line @next/next/no-img-element
|
|
129
128
|
<img
|
|
130
129
|
src={meta.image}
|
|
131
130
|
alt=""
|
|
@@ -142,7 +141,6 @@ export function LinkPreviewCard({
|
|
|
142
141
|
{/* Site row — favicon + site name. */}
|
|
143
142
|
<div className="mb-1 flex items-center gap-1.5 text-xs text-muted-foreground">
|
|
144
143
|
{meta.favicon ? (
|
|
145
|
-
// eslint-disable-next-line @next/next/no-img-element
|
|
146
144
|
<img
|
|
147
145
|
src={meta.favicon}
|
|
148
146
|
alt=""
|
|
@@ -164,7 +162,6 @@ export function LinkPreviewCard({
|
|
|
164
162
|
|
|
165
163
|
{/* Compact thumbnail (compact appearance, when present) — side. */}
|
|
166
164
|
{!isFull && meta.image ? (
|
|
167
|
-
// eslint-disable-next-line @next/next/no-img-element
|
|
168
165
|
<img
|
|
169
166
|
src={meta.image}
|
|
170
167
|
alt=""
|
|
@@ -277,7 +277,6 @@ export const MarkdownEditor = forwardRef<MarkdownEditorHandle, MarkdownEditorPro
|
|
|
277
277
|
!slashWarnedRef.current
|
|
278
278
|
) {
|
|
279
279
|
slashWarnedRef.current = true;
|
|
280
|
-
// eslint-disable-next-line no-console
|
|
281
280
|
console.warn(
|
|
282
281
|
'[MarkdownEditor] `slashCommands` flipped from undefined to a list ' +
|
|
283
282
|
'after mount. Tiptap only installs the SlashCommandNode extension ' +
|
|
@@ -303,7 +302,6 @@ export const MarkdownEditor = forwardRef<MarkdownEditorHandle, MarkdownEditorPro
|
|
|
303
302
|
!warnedRef.current
|
|
304
303
|
) {
|
|
305
304
|
warnedRef.current = true;
|
|
306
|
-
// eslint-disable-next-line no-console
|
|
307
305
|
console.warn(
|
|
308
306
|
'[MarkdownEditor] `mentions` flipped from undefined to a config ' +
|
|
309
307
|
'after mount. Tiptap only installs the Mention extension on first ' +
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
import { Node, mergeAttributes, InputRule } from '@tiptap/core';
|
|
49
49
|
import type { JSONContent, MarkdownRendererHelpers, RenderContext } from '@tiptap/core';
|
|
50
50
|
import { Plugin, PluginKey, TextSelection } from '@tiptap/pm/state';
|
|
51
|
-
import { Fragment, Slice
|
|
51
|
+
import { Fragment, Slice } from '@tiptap/pm/model';
|
|
52
52
|
import { findFilePaths, splitPath, truncatePathLabel } from '../filePath/detect';
|
|
53
53
|
import { findUrls, splitUrl, truncateUrlLabel, faviconUrl } from '../url/detect';
|
|
54
54
|
import { getFileIcon } from '@djangocfg/widget-data/file-icon/get-file-icon';
|
|
@@ -327,7 +327,6 @@ export const ChipNode = Node.create<ChipNodeOptions>({
|
|
|
327
327
|
// positions.
|
|
328
328
|
const tokenStart = textNodeStart + tokenStartInText;
|
|
329
329
|
const sliceFrom = tokenStart + found.start;
|
|
330
|
-
const sliceTo = tokenStart + found.end;
|
|
331
330
|
// Any token chars the detector trimmed off the end (e.g. trailing
|
|
332
331
|
// prose punctuation) stay as text, then the boundary char.
|
|
333
332
|
const tail = token.slice(found.end) + boundary;
|
|
@@ -5,7 +5,7 @@ import type { MentionMarkdownRenderer } from './types';
|
|
|
5
5
|
* Conservative — covers the chars that would break `[text](url)` and
|
|
6
6
|
* inline emphasis when a label contains them.
|
|
7
7
|
*/
|
|
8
|
-
const escapeMd = (s: string): string => s.replace(/([
|
|
8
|
+
const escapeMd = (s: string): string => s.replace(/([\\[\]()_*~`])/g, '\\$1');
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Built-in serializers for the `MentionConfig.renderMarkdown` callback.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Extension } from '@tiptap/core';
|
|
2
2
|
import Suggestion, { type SuggestionOptions } from '@tiptap/suggestion';
|
|
3
|
+
import type { SlashItem } from './slashItems';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Tiptap extension that wires `@tiptap/suggestion` for the slash menu.
|
|
@@ -7,9 +8,8 @@ import Suggestion, { type SuggestionOptions } from '@tiptap/suggestion';
|
|
|
7
8
|
* passed in via options — keeps this file UI-agnostic and lets the
|
|
8
9
|
* popover live in `createSlashSuggestion.ts`.
|
|
9
10
|
*/
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
11
|
export interface SlashExtensionOptions {
|
|
12
|
-
suggestion: Omit<SuggestionOptions<
|
|
12
|
+
suggestion: Omit<SuggestionOptions<SlashItem>, 'editor'>;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export const SlashExtension = Extension.create<SlashExtensionOptions>({
|
|
@@ -17,7 +17,7 @@ export const SlashExtension = Extension.create<SlashExtensionOptions>({
|
|
|
17
17
|
|
|
18
18
|
addOptions() {
|
|
19
19
|
return {
|
|
20
|
-
suggestion: { char: '/' } as Omit<SuggestionOptions<
|
|
20
|
+
suggestion: { char: '/' } as Omit<SuggestionOptions<SlashItem>, 'editor'>,
|
|
21
21
|
};
|
|
22
22
|
},
|
|
23
23
|
|