@flexiui/svelte-rich-text 0.0.51 → 0.0.53

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,65 +1,69 @@
1
- <script lang="ts">
2
- import {
3
- Mathematics,
4
- migrateMathStrings,
5
- } from "@tiptap/extension-mathematics";
6
-
7
- import { HEADINGS, rgbToHex } from "./utils";
8
- import "./styles.css";
9
- import "katex/dist/katex.min.css";
10
-
11
- import { onMount, onDestroy } from "svelte";
12
- import type { Readable } from "svelte/store";
13
-
14
- import {
15
- createEditor,
16
- Editor,
17
- EditorContent,
18
- BubbleMenu,
19
- } from "svelte-tiptap";
20
-
21
- import { computePosition, offset, autoUpdate } from "@floating-ui/dom";
22
- import { getRichTextExtensions } from "./getExtensions";
23
- import { CellSelection } from "prosemirror-tables";
24
-
25
- declare interface Props {
26
- id?: string;
27
- className?: string;
28
- editable?: boolean;
29
- content?: any;
30
- customExtensions?: any[];
31
- editorEvents?: {
32
- onTransaction?: (params: any) => void;
33
- onBeforeCreate?: (params: any) => void;
34
- onCreate?: (params: any) => void;
35
- onUpdate: (params: any) => void;
36
- onFocus?: (params: any) => void;
37
- onBlur?: (params: any) => void;
38
- onDestroy?: (params: any) => void;
39
- onDrop?: (params: any) => void;
40
- onDelete?: (params: any) => void;
41
- onContentError?: (params: any) => void;
42
- onSelectionUpdate?: (params: any) => void;
43
- onPaste?: (params: any) => void;
44
- };
45
- config?: {
46
- editorAccentColor?: string;
47
- editorBgColor?: string;
48
- editorRadius?: string;
49
- toolbarStickyPosition?: number;
50
- toolbarZIndex?: number;
51
- toolbarBgColor?: string;
52
- toolbarPadding?: string;
53
- toolbarGap?: string;
54
- docMaxWidth?: string;
55
- docPadding?: string;
56
- docBg?: string;
57
- docMarginInline?: string;
58
- docMarginBlock?: string;
59
- docRadius?: string;
60
- buttonStyle?: "accent-soft" | "accent-solid";
61
- };
62
- }
1
+ <script lang="ts">
2
+ import {
3
+ Mathematics,
4
+ migrateMathStrings,
5
+ } from "@tiptap/extension-mathematics";
6
+
7
+ import { HEADINGS, rgbToHex } from "./utils";
8
+ import "./styles.css";
9
+ import "katex/dist/katex.min.css";
10
+
11
+ import { onMount, onDestroy } from "svelte";
12
+ import type { Readable } from "svelte/store";
13
+
14
+ import {
15
+ createEditor,
16
+ Editor,
17
+ EditorContent,
18
+ BubbleMenu,
19
+ } from "svelte-tiptap";
20
+
21
+ import { computePosition, offset, autoUpdate } from "@floating-ui/dom";
22
+ import { getRichTextExtensions } from "./getExtensions";
23
+ import { CellSelection } from "prosemirror-tables";
24
+
25
+ export interface Props {
26
+ id?: string;
27
+ className?: string;
28
+ editable?: boolean;
29
+ content?: string | {type: string, content: any[]} | null;
30
+ customExtensions?: any[];
31
+ editorEvents?: {
32
+ onTransaction?: (params: any) => void;
33
+ onBeforeCreate?: (params: any) => void;
34
+ onCreate?: (params: any) => void;
35
+ onUpdate: (params: any) => void;
36
+ onFocus?: (params: any) => void;
37
+ onBlur?: (params: any) => void;
38
+ onDestroy?: (params: any) => void;
39
+ onDrop?: (params: any) => void;
40
+ onDelete?: (params: any) => void;
41
+ onContentError?: (params: any) => void;
42
+ onSelectionUpdate?: (params: any) => void;
43
+ onPaste?: (params: any) => void;
44
+ };
45
+ config?: {
46
+ editorAccentColor?: string;
47
+ editorBgColor?: string;
48
+ editorRadius?: string;
49
+ toolbarStickyPosition?: number;
50
+ toolbarZIndex?: number;
51
+ toolbarBgColor?: string;
52
+ toolbarTextColor?: string;
53
+ toolbarPadding?: string;
54
+ toolbarGap?: string;
55
+ docMaxWidth?: string;
56
+ docPadding?: string;
57
+ docBg?: string;
58
+ docMarginInline?: string;
59
+ docMarginBlock?: string;
60
+ docRadius?: string;
61
+ docTextColor?: string;
62
+ buttonStyle?: "accent-soft" | "accent-solid";
63
+ };
64
+ }
65
+
66
+ export type RichTextProps = Props;
63
67
 
64
68
  let {
65
69
  id = "fl-rich-text-editor",
@@ -91,6 +95,7 @@
91
95
  editorRadius: "12px",
92
96
  toolbarStickyPosition: 0,
93
97
  toolbarBgColor: "#242424",
98
+ toolbarTextColor: "currentColor",
94
99
  toolbarZIndex: 10,
95
100
  toolbarPadding: "8px",
96
101
  toolbarGap: "5px",
@@ -100,6 +105,7 @@
100
105
  docMarginInline: "auto",
101
106
  docMarginBlock: "2rem",
102
107
  docRadius: "0",
108
+ docTextColor: "currentColor",
103
109
  buttonStyle: "accent-solid",
104
110
  };
105
111
 
@@ -555,12 +561,14 @@
555
561
  --fl-toolbar-padding: {editorConfig.toolbarPadding};
556
562
  --fl-toolbar-gap: {editorConfig.toolbarGap};
557
563
  --fl-toolbar-bg: {editorConfig.toolbarBgColor};
564
+ --fl-toolbar-text-color: {editorConfig.toolbarTextColor};
558
565
  --fl-doc-max-width: {editorConfig.docMaxWidth};
559
566
  --fl-doc-padding: {editorConfig.docPadding};
560
567
  --fl-doc-bg: {editorConfig.docBg};
561
568
  --fl-doc-margin-inline: {editorConfig.docMarginInline};
562
569
  --fl-doc-margin-block: {editorConfig.docMarginBlock};
563
570
  --fl-doc-radius: {editorConfig.docRadius};
571
+ --fl-doc-text-color: {editorConfig.docTextColor};
564
572
  "
565
573
  >
566
574
  {#if editor}
@@ -1,6 +1,50 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  import "./styles.css";
3
3
  import "katex/dist/katex.min.css";
4
+ export interface Props {
5
+ id?: string;
6
+ className?: string;
7
+ editable?: boolean;
8
+ content?: string | {
9
+ type: string;
10
+ content: any[];
11
+ } | null;
12
+ customExtensions?: any[];
13
+ editorEvents?: {
14
+ onTransaction?: (params: any) => void;
15
+ onBeforeCreate?: (params: any) => void;
16
+ onCreate?: (params: any) => void;
17
+ onUpdate: (params: any) => void;
18
+ onFocus?: (params: any) => void;
19
+ onBlur?: (params: any) => void;
20
+ onDestroy?: (params: any) => void;
21
+ onDrop?: (params: any) => void;
22
+ onDelete?: (params: any) => void;
23
+ onContentError?: (params: any) => void;
24
+ onSelectionUpdate?: (params: any) => void;
25
+ onPaste?: (params: any) => void;
26
+ };
27
+ config?: {
28
+ editorAccentColor?: string;
29
+ editorBgColor?: string;
30
+ editorRadius?: string;
31
+ toolbarStickyPosition?: number;
32
+ toolbarZIndex?: number;
33
+ toolbarBgColor?: string;
34
+ toolbarTextColor?: string;
35
+ toolbarPadding?: string;
36
+ toolbarGap?: string;
37
+ docMaxWidth?: string;
38
+ docPadding?: string;
39
+ docBg?: string;
40
+ docMarginInline?: string;
41
+ docMarginBlock?: string;
42
+ docRadius?: string;
43
+ docTextColor?: string;
44
+ buttonStyle?: "accent-soft" | "accent-solid";
45
+ };
46
+ }
47
+ export type RichTextProps = Props;
4
48
  declare const __propDef: {
5
49
  props: Record<string, never>;
6
50
  events: {
@@ -8,9 +52,9 @@ declare const __propDef: {
8
52
  };
9
53
  slots: {};
10
54
  };
11
- export type RichTextProps = typeof __propDef.props;
55
+ type RichTextProps_ = typeof __propDef.props;
12
56
  export type RichTextEvents = typeof __propDef.events;
13
57
  export type RichTextSlots = typeof __propDef.slots;
14
- export default class RichText extends SvelteComponentTyped<RichTextProps, RichTextEvents, RichTextSlots> {
58
+ export default class RichText extends SvelteComponentTyped<RichTextProps_, RichTextEvents, RichTextSlots> {
15
59
  }
16
60
  export {};
@@ -1,7 +1,6 @@
1
- interface RenderOptions {
1
+ export interface RenderOptions {
2
2
  json: any;
3
3
  customExtensions?: any[];
4
4
  customNodeMapping?: any;
5
5
  }
6
6
  export declare function renderHTMLFromJSON({ json, customExtensions, customNodeMapping }: RenderOptions): string;
7
- export {};
package/dist/styles.css CHANGED
@@ -14,6 +14,7 @@
14
14
  --fl-toolbar-padding: 6px;
15
15
  --fl-toolbar-gap: 5px;
16
16
  --fl-toolbar-bg: #242424;
17
+ --fl-toolbar-text-color: currentColor;
17
18
 
18
19
  --fl-doc-max-width: 1024px;
19
20
  --fl-doc-padding: 2rem;
@@ -21,6 +22,8 @@
21
22
  --fl-doc-margin-inline: auto;
22
23
  --fl-doc-margin-block: 2rem;
23
24
  --fl-doc-radius: 0;
25
+ --fl-doc-text-color: currentColor;
26
+
24
27
  }
25
28
 
26
29
  /* Basic editor styles */
@@ -39,6 +42,7 @@
39
42
  .fl-rich-text-doc {
40
43
  padding: var(--fl-doc-padding, 2rem);
41
44
  background: var(--fl-doc-bg, transparent);
45
+ color: var(--fl-doc-text-color, currentColor);
42
46
  border-radius: var(--fl-doc-radius, 12px);
43
47
  width: 100%;
44
48
  max-width: var(--fl-doc-max-width, 1024px);
@@ -86,7 +90,6 @@
86
90
  height: 100%;
87
91
  min-height: 56px;
88
92
  background-color: var(--fl-editor-bg, #242424);
89
- color: var(--text-color);
90
93
  box-sizing: border-box;
91
94
  border-radius: var(--fl-editor-radius);
92
95
 
@@ -177,6 +180,7 @@
177
180
  top: var(--fl-toolbar-sticky-position, 0);
178
181
  z-index: var(--fl-toolbar-z-index, 10);
179
182
  background: var(--fl-toolbar-bg, #242424);
183
+ color: var(--fl-toolbar-text-color);
180
184
  border-radius: var(--fl-editor-radius);
181
185
  }
182
186
 
@@ -191,7 +195,7 @@
191
195
  border: none;
192
196
  background: rgba(255, 255, 255, 0.1);
193
197
  border-radius: 8px;
194
- color: var(--text-color);
198
+ color: currentColor;
195
199
  font-size: 14px;
196
200
  display: flex;
197
201
  align-items: center;
@@ -0,0 +1,6 @@
1
+ /// <reference types="svelte" />
2
+ import type { Props } from './RichText.svelte';
3
+
4
+ declare module "*.svelte" {
5
+ interface $$Props extends Props {}
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flexiui/svelte-rich-text",
3
- "version": "0.0.51",
3
+ "version": "0.0.53",
4
4
  "description": "A lightweight and flexible rich text editor component for Svelte",
5
5
  "keywords": [
6
6
  "svelte",