From 2b23caa8d3d353d45380dd6758bef060693da102 Mon Sep 17 00:00:00 2001 From: Phodal Huang Date: Thu, 23 Nov 2023 11:37:10 +0800 Subject: [PATCH] docs: update for todos --- README.md | 23 +++++++++++++++---- .../editor/intelli/menu/context-menu.jsx | 0 .../editor/intelli/menu/menu-bubble.jsx | 13 ++++++++++- package-lock.json | 4 +++- package.json | 1 + 5 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 components/editor/intelli/menu/context-menu.jsx diff --git a/README.md b/README.md index 73ce363..50f3547 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,8 @@ > 3b is a sophisticated editor designed for content creation, catering to various formats such as blogs, articles, user > stories, and more. -In the documentary "10 Years with Hayao Miyazaki" the esteemed artist (宫崎骏, 宮﨑駿/みやざきはやお) chooses a 3B pencil, +In the documentary "10 Years with Hayao Miyazaki" the esteemed artist (宫崎骏, 宮﨑駿/みやざきはやお) chooses a 3B +pencil, deeming conventional ones too inflexible for his creative process. Let us pay homage to his lofty ideals. Todos @@ -18,10 +19,11 @@ Todos - [x] Quick Insert. Type `Command` + `/` or `Ctrl` + `/` to show menu. - [ ] Context Menu. Right click to show menu. - [ ] Diff - - [ ] JSON Schema, like lines, $from, $to + - [ ] GPT JSON Schema: like lines, $from, $to - [ ] Diff algorithm - - [x] Diff Viewer Change - Diff [https://github.com/chenyuncai/tiptap-track-change-extension](https://github.com/chenyuncai/tiptap-track-change-extension) + - [ ] Change accept/reject + - [x] Tiptap: [track-change-extension](https://github.com/chenyuncai/tiptap-track-change-extension) + - [ ] ProseMirror Change: [Changeset](https://github.com/ProseMirror/prosemirror-changeset) - [ ] More plugins for Intelli: [https://github.com/ueberdosis/tiptap/issues/819](https://github.com/ueberdosis/tiptap/issues/819) - [ ] Customize prompt @@ -37,6 +39,19 @@ Todos - [ ] Online Runtime - [ ] Unit Runtime +## Design Principle + +- [Facets as Composable Extension Points](https://marijnhaverbeke.nl/blog/facets.html) + +* Composition: Multiple extensions attaching to a given extension point must have their effects combined in a + predictable way. +* Precedence: In cases where combining effects is order-sensitive, it must be easy to reason about and control the order + of the extensions. +* Grouping: Many extensions will need to attach to a number of extension points, or even pull in other extensions that + they depend on. +* Change: The effect produced by extensions may depend on other aspects of the system state, or be explicitly + reconfigured. + ## Refs: ### Tiptap Editor extensions diff --git a/components/editor/intelli/menu/context-menu.jsx b/components/editor/intelli/menu/context-menu.jsx new file mode 100644 index 0000000..e69de29 diff --git a/components/editor/intelli/menu/menu-bubble.jsx b/components/editor/intelli/menu/menu-bubble.jsx index 2e14902..daa0108 100644 --- a/components/editor/intelli/menu/menu-bubble.jsx +++ b/components/editor/intelli/menu/menu-bubble.jsx @@ -1,14 +1,18 @@ import { BubbleMenu } from '@tiptap/react' import React from 'react' import { MagicWandIcon } from '@radix-ui/react-icons' +import { Span, Change, ChangeSet } from 'prosemirror-changeset' + +const { computeDiff } = ChangeSet export const MenuBubble = ({ editor }) => { const selection = editor.commands.getSelectedText() let selectLength = selection?.length ? selection.length : 0 + // 根据长度优化 return - {selectLength > 20 &&
+ {selectLength > 20 &&