@firecms/editor 3.0.0-canary.265 → 3.0.0-canary.266

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.
@@ -1,7 +1,8 @@
1
- import { Node, NodeViewProps } from "@tiptap/core";
2
- export type CustomBlockComponentProps = NodeViewProps;
1
+ import React from "react";
2
+ import { Node } from "@tiptap/core";
3
+ import { ReactNodeViewProps } from "@tiptap/react";
3
4
  export interface CustomBlockOptions {
4
- component: React.ComponentType<CustomBlockComponentProps> | null;
5
+ component: React.ComponentType<ReactNodeViewProps> | null;
5
6
  delimiter?: string;
6
7
  }
7
8
  export declare const CustomBlock: Node<CustomBlockOptions, any>;
package/dist/index.es.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import React, { forwardRef, useRef, useEffect, useState, useImperativeHandle, useMemo, useDeferredValue } from "react";
3
- import { CheckIcon, TextFieldsIcon, LooksOneIcon, LooksTwoIcon, Looks3Icon, CheckBoxIcon, FormatListBulletedIcon, FormatListNumberedIcon, FormatQuoteIcon, CodeIcon, KeyboardArrowDownIcon, Button, Popover, cls, focusedDisabled, DeleteIcon, FormatBoldIcon, FormatItalicIcon, FormatUnderlinedIcon, FormatStrikethroughIcon, defaultBorderMixin, AutoFixHighIcon, ImageIcon, useInjectStyles, Separator } from "@firecms/ui";
3
+ import { TextFieldsIcon, LooksOneIcon, LooksTwoIcon, Looks3Icon, CheckBoxIcon, FormatListBulletedIcon, FormatListNumberedIcon, FormatQuoteIcon, CodeIcon, CheckIcon, KeyboardArrowDownIcon, Button, Popover, cls, focusedDisabled, DeleteIcon, FormatBoldIcon, FormatItalicIcon, FormatUnderlinedIcon, FormatStrikethroughIcon, defaultBorderMixin, ImageIcon, AutoFixHighIcon, useInjectStyles, Separator } from "@firecms/ui";
4
4
  import { useCurrentEditor, BubbleMenu, isNodeSelection, Node, mergeAttributes, ReactRenderer, EditorProvider } from "@tiptap/react";
5
5
  import Document from "@tiptap/extension-document";
6
6
  import { Markdown } from "tiptap-markdown";
@@ -526,7 +526,7 @@ const TextButtons = () => {
526
526
  }, {
527
527
  name: "code",
528
528
  isActive: _temp9,
529
- command: _temp10,
529
+ command: _temp0,
530
530
  icon: CodeIcon
531
531
  }];
532
532
  t0 = /* @__PURE__ */ jsx("div", { className: "flex", children: items2.map((item, index) => /* @__PURE__ */ jsx(EditorBubbleItem, { onSelect: (editor_10) => {
@@ -569,7 +569,7 @@ function _temp8(editor_7) {
569
569
  function _temp9(editor_8) {
570
570
  return editor_8?.isActive("code") ?? false;
571
571
  }
572
- function _temp10(editor_9) {
572
+ function _temp0(editor_9) {
573
573
  return editor_9?.chain().focus().toggleCode().run();
574
574
  }
575
575
  function removeClassesFromJson(jsonObj) {
@@ -692,7 +692,10 @@ const PlaceholderExtension = Placeholder.configure({
692
692
  node,
693
693
  editor
694
694
  }) => {
695
- editor.state.selection;
695
+ const {
696
+ from,
697
+ to
698
+ } = editor.state.selection;
696
699
  function hasLoadingDecoration(editor2) {
697
700
  const pluginState = loadingDecorationKey.get(editor2.state);
698
701
  return pluginState?.getState(editor2.state)?.hasDecoration ?? false;
@@ -1930,52 +1933,19 @@ const FireCMSEditor = ({
1930
1933
  }
1931
1934
  };
1932
1935
  const proseClass = proseClasses[textSize];
1933
- const extensions = useMemo(() => [
1934
- starterKit,
1935
- CustomDocument,
1936
- HighlightDecorationExtension(highlight),
1937
- TextLoadingDecorationExtension,
1938
- Underline,
1939
- Bold,
1940
- TextStyle,
1941
- Italic,
1942
- Strike,
1943
- Color,
1944
- Highlight.configure({
1945
- multicolor: true
1946
- }),
1947
- // CustomBlock.configure({
1948
- // component: CustomComponent,
1949
- // delimiter: "```custom"
1950
- // }),
1951
- Heading,
1952
- CustomKeymap,
1953
- DragAndDrop,
1954
- placeholder,
1955
- tiptapLink,
1956
- imageExtension,
1957
- taskList,
1958
- taskItem,
1959
- Markdown.configure({
1960
- html: true
1961
- }),
1962
- horizontalRule,
1963
- bulletList,
1964
- orderedList,
1965
- listItem,
1966
- blockquote,
1967
- codeBlock,
1968
- code,
1969
- SlashCommand.configure({
1970
- HTMLAttributes: {
1971
- class: "mention"
1972
- },
1973
- suggestion: suggestion(ref, {
1974
- upload: handleImageUpload,
1975
- aiController
1976
- })
1936
+ const extensions = useMemo(() => [starterKit, CustomDocument, HighlightDecorationExtension(highlight), TextLoadingDecorationExtension, Underline, Bold, TextStyle, Italic, Strike, Color, Highlight.configure({
1937
+ multicolor: true
1938
+ }), Heading, CustomKeymap, DragAndDrop, placeholder, tiptapLink, imageExtension, taskList, taskItem, Markdown.configure({
1939
+ html: true
1940
+ }), horizontalRule, bulletList, orderedList, listItem, blockquote, codeBlock, code, SlashCommand.configure({
1941
+ HTMLAttributes: {
1942
+ class: "mention"
1943
+ },
1944
+ suggestion: suggestion(ref, {
1945
+ upload: handleImageUpload,
1946
+ aiController
1977
1947
  })
1978
- ], []);
1948
+ })], []);
1979
1949
  return /* @__PURE__ */ jsx("div", { ref, className: "relative min-h-[300px] w-full", children: /* @__PURE__ */ jsx(EditorProvider, { content: content ?? "", extensions, editorProps: {
1980
1950
  editable: () => !disabled,
1981
1951
  attributes: {