@scottjgilbert/lexical-blog-editor 1.0.0-beta.1 → 1.0.0-beta.2

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/build/Editor.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- import { EditorState } from "lexical";
1
+ import type { EditorState } from "lexical";
2
2
  import React from "react";
3
3
  import "./index.css";
4
4
  export interface EditorProps {
5
5
  placeholder?: string;
6
6
  initialState?: EditorState;
7
- onChange: (state: EditorState, html: string) => void;
7
+ onChange: (state: EditorState) => void;
8
8
  }
9
9
  export declare const EditorComponent: ({ placeholder, onChange, }: {
10
10
  placeholder?: string;
11
- onChange: (state: EditorState, html: string) => void;
11
+ onChange: (state: EditorState) => void;
12
12
  }) => import("react/jsx-runtime").JSX.Element;
13
13
  /**
14
14
  * A full Rich Text Editor component.
@@ -1 +1 @@
1
- {"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../src/Editor.tsx"],"names":[],"mappings":"AAwDA,OAAO,EAIL,WAAW,EAEZ,MAAM,SAAS,CAAC;AAQjB,OAAO,KAAkB,MAAM,OAAO,CAAC;AAKvC,OAAO,aAAa,CAAC;AAcrB,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACtD;AAED,eAAO,MAAM,eAAe,GAAI,4BAG7B;IACD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACtD,4CAgJA,CAAC;AAEF;;;;GAIG;AAEH,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA8BxC,CAAC"}
1
+ {"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../src/Editor.tsx"],"names":[],"mappings":"AA+DA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAM3C,OAAO,KAAkB,MAAM,OAAO,CAAC;AAKvC,OAAO,aAAa,CAAC;AAcrB,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;CACxC;AAED,eAAO,MAAM,eAAe,GAAI,4BAG7B;IACD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;CACxC,4CAwIA,CAAC;AAEF;;;;GAIG;AAEH,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA8BxC,CAAC"}
package/build/Editor.js CHANGED
@@ -51,7 +51,6 @@ import YouTubePlugin from "./plugins/YouTubePlugin";
51
51
  import ContentEditable from "./ui/ContentEditable";
52
52
  import { $createHeadingNode } from "@lexical/rich-text";
53
53
  import { $getRoot, $createParagraphNode, defineExtension, $createTextNode, } from "lexical";
54
- import { $generateHtmlFromNodes } from "@lexical/html";
55
54
  import { LexicalExtensionComposer } from "@lexical/react/LexicalExtensionComposer";
56
55
  import { TableContext } from "./plugins/TablePlugin";
57
56
  import { ToolbarContext } from "./context/ToolbarContext";
@@ -65,10 +64,10 @@ import { HorizontalRuleExtension } from "@lexical/extension";
65
64
  function $prepopulatedRichText() {
66
65
  const root = $getRoot();
67
66
  const heading = $createHeadingNode("h1");
68
- heading.append($createTextNode("Lexical Rich Text Editor"));
67
+ heading.append($createTextNode("Rich Blog Editor"));
69
68
  root.append(heading);
70
69
  const paragraph = $createParagraphNode();
71
- paragraph.append($createTextNode("Welcome to the rich text editor!"));
70
+ paragraph.append($createTextNode("Welcome to the rich blog editor!"));
72
71
  root.append(paragraph);
73
72
  }
74
73
  export const EditorComponent = ({ placeholder = "Enter some text...", onChange, }) => {
@@ -89,13 +88,7 @@ export const EditorComponent = ({ placeholder = "Enter some text...", onChange,
89
88
  useEffect(() => {
90
89
  // most listeners return a teardown function that can be called to clean them up.
91
90
  return editor.registerUpdateListener(({ editorState }) => {
92
- editor.read(() => {
93
- onChange(editorState,
94
- //Need to modify generateHtml to auto-inject classes for styling
95
- '<div class="lexical-blog-output">' +
96
- $generateHtmlFromNodes(editor) +
97
- "</div>");
98
- });
91
+ onChange(editorState);
99
92
  });
100
93
  }, [editor, onChange]);
101
94
  return null;
@@ -167,6 +167,7 @@
167
167
  overflow-x: auto;
168
168
  position: relative;
169
169
  tab-size: 2;
170
+ white-space: pre;
170
171
  }
171
172
  .PlaygroundEditorTheme__code:before {
172
173
  content: attr(data-gutter);
@@ -181,6 +182,9 @@
181
182
  text-align: right;
182
183
  min-width: 25px;
183
184
  }
185
+ .PlaygroundEditorTheme__code span {
186
+ white-space: nowrap;
187
+ }
184
188
  .PlaygroundEditorTheme__tableScrollableWrapper {
185
189
  overflow-x: auto;
186
190
  margin: 0px 25px 30px 0px;
@@ -167,6 +167,10 @@
167
167
  overflow-x: auto;
168
168
  position: relative;
169
169
  tab-size: 2;
170
+ white-space: pre;
171
+ }
172
+ .ViewerTheme__code span {
173
+ white-space: nowrap;
170
174
  }
171
175
  /* Apply padding if the pre is empty OR if the last child isn't a span */
172
176
  .ViewerTheme__code:empty::after,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scottjgilbert/lexical-blog-editor",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.2",
4
4
  "description": "Prebuilt components for editing and rendering rich blog content with Lexical. Modified wrapper of the Lexical Playground editor.",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",