From 0e6190bdea14b170db437926da3c084237d91908 Mon Sep 17 00:00:00 2001 From: suragch Date: Thu, 28 Nov 2024 16:26:28 +0800 Subject: [PATCH 01/13] super editor: quickstart --- .../source/super-editor/guides/quickstart.md | 91 +++++++++++-------- 1 file changed, 53 insertions(+), 38 deletions(-) diff --git a/doc/website/source/super-editor/guides/quickstart.md b/doc/website/source/super-editor/guides/quickstart.md index d406f8e5ba..e0230f4d6a 100644 --- a/doc/website/source/super-editor/guides/quickstart.md +++ b/doc/website/source/super-editor/guides/quickstart.md @@ -2,68 +2,83 @@ title: Super Editor Quickstart contentRenderers: ["jinja", "markdown"] --- + # Super Editor Quickstart -Super Editor comes with sane defaults to help you get started with an editor experience, quickly. These defaults include support for images, list items, blockquotes, and horizontal rules, as well as selection gestures, and various keyboard shortcuts. + +Super Editor comes with sane defaults to help you get quickly started with an editor experience. These defaults include support for images, list items, blockquotes, and horizontal rules, as well as selection gestures and various keyboard shortcuts. Drop in the default editor and start editing. ## Add super_editor to your project + To use super_editor, add a dependency in your pubspec.yaml. ```yaml dependencies: - super_editor: {{ pub.super_editor.version }} + super_editor: ^0.3.0 ``` ## Display an editor -A visual editor first requires a logical editor. A logical editor holds an underlying document, which the user edits, and a composer to manage the user's selection. -Initialize the logical editor. +Super Editor is both the visual editor that users see and interact with, as well as the logical editor that handles those interactions behind the scenes. + +Start by initializing the logical editor and its required components: ```dart -class MyApp extends StatefulWidget { - State createState() => _MyApp(); +import 'package:flutter/widgets.dart'; +import 'package:super_editor/super_editor.dart'; + +class MyEditorPage extends StatefulWidget { + const MyEditorPage({super.key}); + + @override + State createState() => _MyEditorPageState(); } -class _MyApp extends State { - late final Editor _editor; - late final MutableDocument _document; - late final MutableDocumentComposer _composer; - - void initState() { - super.initState(); - - _document = MutableDocument.empty(); - - _composer = MutableDocumentComposer(); - - _editor = Editor(); - } - - void dispose() { - _editor.dispose(); - _composer.dispose(); - _document.dispose(); - - super.dispose(); - } +class _MyEditorPageState extends State { + late MutableDocument _document; + late MutableDocumentComposer _composer; + late Editor _editor; + + @override + void initState() { + super.initState(); + _document = MutableDocument.empty(); + _composer = MutableDocumentComposer(); + _editor = createDefaultDocumentEditor( + document: _document, + composer: _composer, + ); + } + + @override + void dispose() { + _composer.dispose(); + _document.dispose(); + super.dispose(); + } + + // More to come... } ``` + +Here are a few points to note: + +- The logical editor holds an underlying document and a composer to manage the user's selection. +- The document, MutableDocument, contains a list of nodes for content like text, images, and so on, which users can edit. In this case, you're starting with an empty list. +- createDefaultDocumentEditor is a convenience method from super_editor to give you some of those sane defaults mentioned earlier. -With the logical pieces ready, you can now display a visual editor. Build a SuperEditor widget and return it from your build() method. +With the logical pieces ready, you can now display a visual editor. Add a build() method that returns a SuperEditor widget with its logical editor: ```dart -class _MyApp extends State { - // ... - - Widget build(BuildContext context) { - return SuperEditor( - editor: _editor, - ); - } +@override +Widget build(BuildContext context) { + return SuperEditor( + editor: _editor, + ); } ``` That's all it takes to get started with your very own editor. Run your app, tap in the editor, and start typing! -The next step is configuration. Check out the other guides for more help. \ No newline at end of file +Check out the other guides for more help. \ No newline at end of file From 9afb4479ab5daa0c2c89e631e081626f525848a5 Mon Sep 17 00:00:00 2001 From: suragch Date: Mon, 2 Dec 2024 13:03:42 +0800 Subject: [PATCH 02/13] use backticks instead of tags --- doc/website/source/super-editor/guides/quickstart.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/website/source/super-editor/guides/quickstart.md b/doc/website/source/super-editor/guides/quickstart.md index e0230f4d6a..6d2af2fb6d 100644 --- a/doc/website/source/super-editor/guides/quickstart.md +++ b/doc/website/source/super-editor/guides/quickstart.md @@ -9,9 +9,9 @@ Super Editor comes with sane defaults to help you get quickly started with an ed Drop in the default editor and start editing. -## Add super_editor to your project +## Add `super_editor` to your project -To use super_editor, add a dependency in your pubspec.yaml. +To use `super_editor`, add a dependency in your `pubspec.yaml`. ```yaml dependencies: @@ -65,10 +65,10 @@ class _MyEditorPageState extends State { Here are a few points to note: - The logical editor holds an underlying document and a composer to manage the user's selection. -- The document, MutableDocument, contains a list of nodes for content like text, images, and so on, which users can edit. In this case, you're starting with an empty list. -- createDefaultDocumentEditor is a convenience method from super_editor to give you some of those sane defaults mentioned earlier. +- The document, `MutableDocument`, contains a list of nodes for content like text, images, and so on, which users can edit. In this case, you're starting with an empty list. +- `createDefaultDocumentEditor` is a convenience method from `super_editor` to give you some of those sane defaults mentioned earlier. -With the logical pieces ready, you can now display a visual editor. Add a build() method that returns a SuperEditor widget with its logical editor: +With the logical pieces ready, you can now display a visual editor. Add a `build()` method that returns a `SuperEditor` widget with its logical editor: ```dart @override From 7a74a5aa9af309508aaf2b8b4406f568eaf35252 Mon Sep 17 00:00:00 2001 From: suragch Date: Mon, 2 Dec 2024 13:06:03 +0800 Subject: [PATCH 03/13] Matt prefers no blank lines after headers --- doc/website/source/super-editor/guides/quickstart.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/doc/website/source/super-editor/guides/quickstart.md b/doc/website/source/super-editor/guides/quickstart.md index 6d2af2fb6d..7971439b87 100644 --- a/doc/website/source/super-editor/guides/quickstart.md +++ b/doc/website/source/super-editor/guides/quickstart.md @@ -4,13 +4,11 @@ contentRenderers: ["jinja", "markdown"] --- # Super Editor Quickstart - Super Editor comes with sane defaults to help you get quickly started with an editor experience. These defaults include support for images, list items, blockquotes, and horizontal rules, as well as selection gestures and various keyboard shortcuts. Drop in the default editor and start editing. ## Add `super_editor` to your project - To use `super_editor`, add a dependency in your `pubspec.yaml`. ```yaml @@ -19,7 +17,6 @@ dependencies: ``` ## Display an editor - Super Editor is both the visual editor that users see and interact with, as well as the logical editor that handles those interactions behind the scenes. Start by initializing the logical editor and its required components: From 59a161c58675adb5853be40718c51eb0eadabca2 Mon Sep 17 00:00:00 2001 From: suragch Date: Mon, 2 Dec 2024 13:18:16 +0800 Subject: [PATCH 04/13] use a variable for the version number --- doc/website/source/_data.yaml | 4 +++- doc/website/source/super-editor/guides/quickstart.md | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/website/source/_data.yaml b/doc/website/source/_data.yaml index 6ccacaaa7d..3ef64a4ce8 100644 --- a/doc/website/source/_data.yaml +++ b/doc/website/source/_data.yaml @@ -24,4 +24,6 @@ navigation: - title: Super Reader url: /super-reader-guides - title: Super Text Field - url: /super-text-field-guides \ No newline at end of file + url: /super-text-field-guides + +super_editor_version: "^0.3.0" diff --git a/doc/website/source/super-editor/guides/quickstart.md b/doc/website/source/super-editor/guides/quickstart.md index 7971439b87..1aecc24dc2 100644 --- a/doc/website/source/super-editor/guides/quickstart.md +++ b/doc/website/source/super-editor/guides/quickstart.md @@ -4,7 +4,7 @@ contentRenderers: ["jinja", "markdown"] --- # Super Editor Quickstart -Super Editor comes with sane defaults to help you get quickly started with an editor experience. These defaults include support for images, list items, blockquotes, and horizontal rules, as well as selection gestures and various keyboard shortcuts. +Super Editor comes with sane defaults to help you get started quickly with an editor experience. These defaults include support for images, list items, blockquotes, and horizontal rules, as well as selection gestures and various keyboard shortcuts. Drop in the default editor and start editing. @@ -13,7 +13,7 @@ To use `super_editor`, add a dependency in your `pubspec.yaml`. ```yaml dependencies: - super_editor: ^0.3.0 + super_editor: {{ super_editor_version }} ``` ## Display an editor From 1e759dffee7cc98c215a2c114e51ec98382c98d9 Mon Sep 17 00:00:00 2001 From: suragch Date: Mon, 2 Dec 2024 14:46:22 +0800 Subject: [PATCH 05/13] use the appropriate data file --- doc/website/source/_data.yaml | 4 +--- doc/website/source/super-editor/guides/_data.yaml | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/website/source/_data.yaml b/doc/website/source/_data.yaml index 3ef64a4ce8..6ccacaaa7d 100644 --- a/doc/website/source/_data.yaml +++ b/doc/website/source/_data.yaml @@ -24,6 +24,4 @@ navigation: - title: Super Reader url: /super-reader-guides - title: Super Text Field - url: /super-text-field-guides - -super_editor_version: "^0.3.0" + url: /super-text-field-guides \ No newline at end of file diff --git a/doc/website/source/super-editor/guides/_data.yaml b/doc/website/source/super-editor/guides/_data.yaml index bd224f6199..5b96ffb4ba 100644 --- a/doc/website/source/super-editor/guides/_data.yaml +++ b/doc/website/source/super-editor/guides/_data.yaml @@ -2,6 +2,8 @@ layout: layouts/docs_page.jinja base_path: super-editor/guides/ +super_editor_version: "^0.3.0" + navigation: show_contributors: false From 1ca37a621895745a3924737c8945573f2f218aa3 Mon Sep 17 00:00:00 2001 From: suragch Date: Mon, 2 Dec 2024 15:12:48 +0800 Subject: [PATCH 06/13] update code explanation --- .../source/super-editor/guides/quickstart.md | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/doc/website/source/super-editor/guides/quickstart.md b/doc/website/source/super-editor/guides/quickstart.md index 1aecc24dc2..f446f4feb8 100644 --- a/doc/website/source/super-editor/guides/quickstart.md +++ b/doc/website/source/super-editor/guides/quickstart.md @@ -43,6 +43,7 @@ class _MyEditorPageState extends State { _document = MutableDocument.empty(); _composer = MutableDocumentComposer(); _editor = createDefaultDocumentEditor( + // TODO: Make these optional with reasonable defaults. document: _document, composer: _composer, ); @@ -55,27 +56,27 @@ class _MyEditorPageState extends State { super.dispose(); } - // More to come... + @override + Widget build(BuildContext context) { + return SuperEditor( + editor: _editor, + ); + } } ``` -Here are a few points to note: +Multiple objects work together to edit documents. A `Document` provides a consistent structure for content within a document. A `DocumentComposer` holds the user's current selection, along with any styles that should be applied to newly typed text. An `Editor` alters the `Document`. -- The logical editor holds an underlying document and a composer to manage the user's selection. -- The document, `MutableDocument`, contains a list of nodes for content like text, images, and so on, which users can edit. In this case, you're starting with an empty list. -- `createDefaultDocumentEditor` is a convenience method from `super_editor` to give you some of those sane defaults mentioned earlier. - -With the logical pieces ready, you can now display a visual editor. Add a `build()` method that returns a `SuperEditor` widget with its logical editor: - -```dart -@override -Widget build(BuildContext context) { - return SuperEditor( - editor: _editor, - ); -} -``` +The `Editor` fulfills a number of responsibilities, each of which is configurable. Rather than force every user to fully configure an `Editor`, `super_editor` provides a global factory called `createDefaultDocumentEditor`, which configures an `Editor` with sane defaults. To adjust those defaults, consider copying the implementation of `createDefaultDocumentEditor` and then altering the implementation to meet your needs. + +The `SuperEditor` widget creates a user interface for visualizing the `Document`, changing the selection in the `DocumentComposer`, and submitting change requests to the `Editor`. The `SuperEditor` widget is the part that most people think of when they think of "document editing". The `SuperEditor` widget includes many configurable properties, all of which focus on user interactions, e.g., selection and focus policies, gesture interceptors, scroll control, mobile selection handles, and more. That's all it takes to get started with your very own editor. Run your app, tap in the editor, and start typing! -Check out the other guides for more help. \ No newline at end of file +Continue your Super Editor journey with more beginner guides: + +- [Document](TODO) +- [DocumentComposer](TODO) +- [Editor](TODO) +- [SuperEditor](TODO) +- TODO: other useful next step guides. From a22358b05012463b133a14e3b0875d125924949a Mon Sep 17 00:00:00 2001 From: suragch Date: Thu, 5 Dec 2024 19:01:00 +0800 Subject: [PATCH 07/13] remove instance members, update wording --- .../source/super-editor/guides/quickstart.md | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/doc/website/source/super-editor/guides/quickstart.md b/doc/website/source/super-editor/guides/quickstart.md index f446f4feb8..9cffcaafae 100644 --- a/doc/website/source/super-editor/guides/quickstart.md +++ b/doc/website/source/super-editor/guides/quickstart.md @@ -19,7 +19,7 @@ dependencies: ## Display an editor Super Editor is both the visual editor that users see and interact with, as well as the logical editor that handles those interactions behind the scenes. -Start by initializing the logical editor and its required components: +Start by initializing the logical editor: ```dart import 'package:flutter/widgets.dart'; @@ -33,29 +33,17 @@ class MyEditorPage extends StatefulWidget { } class _MyEditorPageState extends State { - late MutableDocument _document; - late MutableDocumentComposer _composer; late Editor _editor; @override void initState() { super.initState(); - _document = MutableDocument.empty(); - _composer = MutableDocumentComposer(); _editor = createDefaultDocumentEditor( - // TODO: Make these optional with reasonable defaults. - document: _document, - composer: _composer, + document: MutableDocument.empty(), + composer: MutableDocumentComposer(), ); } - @override - void dispose() { - _composer.dispose(); - _document.dispose(); - super.dispose(); - } - @override Widget build(BuildContext context) { return SuperEditor( From 31a8ef1ea07a75ce0257e61182db4f34dc499c8d Mon Sep 17 00:00:00 2001 From: suragch Date: Thu, 5 Dec 2024 19:42:22 +0800 Subject: [PATCH 08/13] update document from markdown guide --- .../guides/document-from-markdown.md | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/doc/website/source/super-editor/guides/document-from-markdown.md b/doc/website/source/super-editor/guides/document-from-markdown.md index 5cfa0073b7..54463c5086 100644 --- a/doc/website/source/super-editor/guides/document-from-markdown.md +++ b/doc/website/source/super-editor/guides/document-from-markdown.md @@ -17,13 +17,27 @@ dependencies: De-serialize a Markdown `String` with the supplied top-level function. ```dart +const markdown = ''' +# Header +This is a _Super_ Editor! +'''; + final document = deserializeMarkdownToDocument(markdown); ``` -The de-serialized document is a `MutableDocument`. Check other guides to find out how to use it. +The de-serialized document is a `MutableDocument`. Add it to your `Editor` similarly to how you did it in the Quickstart guide: + +```dart +_editor = createDefaultDocumentEditor( + document: document, + composer: MutableDocumentComposer(), +); +``` + +Run that, and you'll see the document rendered on the screen. ## Serialize Markdown -Serialize a `Document` to a Markdown `String`. +You can also go the other direction. Here's how you would serialize a `Document` to a Markdown `String`: ```dart final markdown = serializeDocumentToMarkdown(document); From 435f7e5a675b7d7dd7c6c58d93c9b0b07037997c Mon Sep 17 00:00:00 2001 From: suragch Date: Thu, 12 Dec 2024 14:54:32 +0800 Subject: [PATCH 09/13] update Assemple a Document guide --- .../guides/assemble-a-document.md | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/doc/website/source/super-editor/guides/assemble-a-document.md b/doc/website/source/super-editor/guides/assemble-a-document.md index 9c69024ffd..a2821faf5b 100644 --- a/doc/website/source/super-editor/guides/assemble-a-document.md +++ b/doc/website/source/super-editor/guides/assemble-a-document.md @@ -20,8 +20,8 @@ The `MutableDocument` constructor accepts a list of `DocumentNode`s as initial c final document = MutableDocument( nodes: [ ParagraphNode( - id: Editor.createNodeId(), - text: AttributedText(text: "Hello, world!"), + id: "node1", + text: AttributedText("Hello, world!"), ), ], ); @@ -33,24 +33,29 @@ A `MutableDocument` can be altered after construction. You can insert nodes. ```dart -document.insertNodeAt(1, ParagraphNode( - id: Editor.createNodeId(), - text: AttributedText(text: "New paragraph"), -),); +document.insertNodeAt( + 1, + ParagraphNode( + id: Editor.createNodeId(), + text: AttributedText("New paragraph"), + ), +); ``` +`Editor.createNodeId()` is a convenience method that generates a random UUID string for the node. + You can move nodes. ```dart -document.moveNode(nodeId: "node1", targetIndex: 2); +document.moveNode(nodeId: "node1", targetIndex: 1); ``` You can remove nodes. ```dart -document.deleteNodeAt(2); +document.deleteNodeAt(0); ``` If your goal is to use a `MutableDocument` in an editor experience, consider wrapping the `MutableDocument` in an `Editor`, and then use the standard edit pipeline to alter the document's -content. \ No newline at end of file +content. [TODO: what is the standard editor pipeline? Let's link to those docs or give a brief explanation.] \ No newline at end of file From 8cb102a75775da7e9be89068836d1923f05bec1a Mon Sep 17 00:00:00 2001 From: suragch Date: Thu, 12 Dec 2024 15:42:04 +0800 Subject: [PATCH 10/13] update markdown parsing guide --- .../super-editor/guides/markdown/parsing.md | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/doc/website/source/super-editor/guides/markdown/parsing.md b/doc/website/source/super-editor/guides/markdown/parsing.md index 7705963ae4..8856c620f8 100644 --- a/doc/website/source/super-editor/guides/markdown/parsing.md +++ b/doc/website/source/super-editor/guides/markdown/parsing.md @@ -14,9 +14,16 @@ dependencies: super_editor_markdown: ^{{ pub.super_editor_markdown.version }} ``` +[TODO: we use `any` for one and `^{{ pub.super_editor_markdown.version }}` for the other and in another guide we use a variable from `_data.yaml`. Should we use a consistent method or keep them as they are?] + Parse a Markdown document by calling the provided global function: ```dart +const markdownText = ''' +# Header +This is a _Super_ Editor! +'''; + final superEditorDocument = deserializeMarkdownToDocument(markdownText); ``` @@ -77,20 +84,22 @@ final superEditorDocument = deserializeMarkdownToDocument( Markdown is sometimes extended with custom block syntaxes. These are non-standard syntaxes, and they're not understood by standard parsers, like the `markdown` package parser. However, the `markdown` package parser accepts `BlockSyntax` objects to parse custom Markdown blocks, -and Super Editor Markdown forwards those `BlockSyntax`s. +and Super Editor Markdown forwards those `BlockSyntax`es. To parse custom Markdown block syntaxes, pass your `BlockSyntax`s to `deserializeMarkdownToDocument()`: ```dart final superEditorDocument = deserializeMarkdownToDocument( - markdownText, - customBockSyntax: [ - const TableSyntax(), - ], + markdownText, + customBlockSyntax: [ + const TableSyntax(), + ], ); ``` +`TableSyntax` is an example custom `BlockSyntax` that you could create. + ### Custom Super Editor Nodes When parsing custom Markdown syntaxes, you'll need to tell Super Editor Markdown how to convert those syntaxes into Super Editor `DocumentNode`s. Also, sometimes you might want @@ -103,11 +112,13 @@ To customize how Markdown converts into Super Editor documents, provide custom ```dart final superEditorDocument = deserializeMarkdownToDocument( markdownText, - customBockSyntax: [ + customBlockSyntax: [ const TableSyntax(), ], customElementToNodeConverters: [ const MarkdownTableToNodeConverter(), ], ); -``` \ No newline at end of file +``` + +[TODO: Is there any documentation anywhere how to create a `BlockSyntax` or a `TableSyntax` or `MarkdownTableToNodeConverter`? This should be added here.] \ No newline at end of file From b349912680e211ae2656f2dff33230431d3ff6c8 Mon Sep 17 00:00:00 2001 From: suragch Date: Wed, 18 Dec 2024 17:24:52 +0800 Subject: [PATCH 11/13] add link to Quill docs --- doc/website/source/super-editor/guides/quill/parsing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/website/source/super-editor/guides/quill/parsing.md b/doc/website/source/super-editor/guides/quill/parsing.md index a828f211d6..d27ce1f275 100644 --- a/doc/website/source/super-editor/guides/quill/parsing.md +++ b/doc/website/source/super-editor/guides/quill/parsing.md @@ -4,7 +4,7 @@ contentRenderers: - jinja - markdown --- -Super Editor supports parsing of Quill Delta documents into Super Editor documents. +Super Editor supports parsing of [Quill Delta documents](https://quilljs.com/docs/delta/) into Super Editor documents. To get started with parsing Quill documents, add the Super Editor Quill package: From 30f011583974352d01c3ce2731584c2c34bbcd7b Mon Sep 17 00:00:00 2001 From: suragch Date: Wed, 18 Dec 2024 17:51:36 +0800 Subject: [PATCH 12/13] change const to final --- .../source/super-editor/guides/style-a-document.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/website/source/super-editor/guides/style-a-document.md b/doc/website/source/super-editor/guides/style-a-document.md index 17330e540e..6d7daea53f 100644 --- a/doc/website/source/super-editor/guides/style-a-document.md +++ b/doc/website/source/super-editor/guides/style-a-document.md @@ -14,7 +14,7 @@ A `Stylesheet` is a priority list of `StyleRule`s. Each `StyleRule` has a `Block The easiest way is to create a custom stylesheet is to copy the `defaultStylesheet` and add your rules at the end. For example, to make all level one headers green, create the following stylesheet: ```dart -const myStyleSheet = defaultStylesheet.copyWith( +final myStyleSheet = defaultStylesheet.copyWith( addRulesAfter: [ StyleRule( // Matches all level one headers. @@ -45,12 +45,14 @@ class MyApp extends StatelessWidget { See the `Styles` class for the list of keys to the style metadata used by `SuperEditor`. +[TODO: what is the meaning of "key" in this context?] + ## Multiple matching rules Multiple `StyleRule`s can match a single node. When that happens, `SuperEditor` attempts to merge them, by looking at each key. For example, consider the following stylesheet: ```dart -const myStyleSheet = defaultStylesheet.copyWith( +final myStyleSheet = defaultStylesheet.copyWith( addRulesAfter: [ StyleRule( // Matches all level one headers. @@ -79,7 +81,7 @@ Both styles will be applied. Each level one header will have green text with a f If the styles can't be merged, the first one wins. For example, consider the following stylesheet: ```dart -const myStyleSheet = defaultStylesheet.copyWith( +final myStyleSheet = defaultStylesheet.copyWith( addRulesAfter: [ StyleRule( // Matches all nodes. @@ -108,7 +110,7 @@ Since we cannot match two different text alignments, the first one is used. All However, non-conflicting keys are preserved. For example, consider the following stylesheet: ```dart -const myStyleSheet = defaultStylesheet.copyWith( +final myStyleSheet = defaultStylesheet.copyWith( addRulesAfter: [ StyleRule( // Matches all nodes. From ce795b069154e476c1f73c3338d6a5eb115aadf2 Mon Sep 17 00:00:00 2001 From: suragch Date: Thu, 2 Jan 2025 14:33:26 +0800 Subject: [PATCH 13/13] revert some changes --- .../guides/document-from-markdown.md | 18 ++---------------- .../super-editor/guides/markdown/parsing.md | 5 ----- .../source/super-editor/guides/quickstart.md | 8 +------- .../super-editor/guides/style-a-document.md | 2 -- 4 files changed, 3 insertions(+), 30 deletions(-) diff --git a/doc/website/source/super-editor/guides/document-from-markdown.md b/doc/website/source/super-editor/guides/document-from-markdown.md index 54463c5086..5cfa0073b7 100644 --- a/doc/website/source/super-editor/guides/document-from-markdown.md +++ b/doc/website/source/super-editor/guides/document-from-markdown.md @@ -17,27 +17,13 @@ dependencies: De-serialize a Markdown `String` with the supplied top-level function. ```dart -const markdown = ''' -# Header -This is a _Super_ Editor! -'''; - final document = deserializeMarkdownToDocument(markdown); ``` -The de-serialized document is a `MutableDocument`. Add it to your `Editor` similarly to how you did it in the Quickstart guide: - -```dart -_editor = createDefaultDocumentEditor( - document: document, - composer: MutableDocumentComposer(), -); -``` - -Run that, and you'll see the document rendered on the screen. +The de-serialized document is a `MutableDocument`. Check other guides to find out how to use it. ## Serialize Markdown -You can also go the other direction. Here's how you would serialize a `Document` to a Markdown `String`: +Serialize a `Document` to a Markdown `String`. ```dart final markdown = serializeDocumentToMarkdown(document); diff --git a/doc/website/source/super-editor/guides/markdown/parsing.md b/doc/website/source/super-editor/guides/markdown/parsing.md index 8856c620f8..6c3ba43ead 100644 --- a/doc/website/source/super-editor/guides/markdown/parsing.md +++ b/doc/website/source/super-editor/guides/markdown/parsing.md @@ -19,11 +19,6 @@ dependencies: Parse a Markdown document by calling the provided global function: ```dart -const markdownText = ''' -# Header -This is a _Super_ Editor! -'''; - final superEditorDocument = deserializeMarkdownToDocument(markdownText); ``` diff --git a/doc/website/source/super-editor/guides/quickstart.md b/doc/website/source/super-editor/guides/quickstart.md index 9cffcaafae..c25dfd2d9d 100644 --- a/doc/website/source/super-editor/guides/quickstart.md +++ b/doc/website/source/super-editor/guides/quickstart.md @@ -61,10 +61,4 @@ The `SuperEditor` widget creates a user interface for visualizing the `Document` That's all it takes to get started with your very own editor. Run your app, tap in the editor, and start typing! -Continue your Super Editor journey with more beginner guides: - -- [Document](TODO) -- [DocumentComposer](TODO) -- [Editor](TODO) -- [SuperEditor](TODO) -- TODO: other useful next step guides. +Check out the other guides for more help. diff --git a/doc/website/source/super-editor/guides/style-a-document.md b/doc/website/source/super-editor/guides/style-a-document.md index 6d7daea53f..a10c1cb9ac 100644 --- a/doc/website/source/super-editor/guides/style-a-document.md +++ b/doc/website/source/super-editor/guides/style-a-document.md @@ -45,8 +45,6 @@ class MyApp extends StatelessWidget { See the `Styles` class for the list of keys to the style metadata used by `SuperEditor`. -[TODO: what is the meaning of "key" in this context?] - ## Multiple matching rules Multiple `StyleRule`s can match a single node. When that happens, `SuperEditor` attempts to merge them, by looking at each key. For example, consider the following stylesheet: