-
Notifications
You must be signed in to change notification settings - Fork 112
Upgrade/tiptap2 #1981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade/tiptap2 #1981
Conversation
|
FYI I added plain text editing / syntax highlight to the checklist as that is something that has likely changed but we might be able to tackle #1942 (comment) with that. |
747d10d to
d146704
Compare
8fa565c to
e133d85
Compare
abaeba5 to
89f0967
Compare
|
I think the test failure (while testing images features) is caused by a session sync happening after the user has been deleted. It does not happen all the time. |
|
#2167 fixes the Cypress image test. |
julien-nc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried all aspects of the description task list, everything works fine and looks the same as before.
I didn't deeply check the code but lgtm.
It's incredible we don't loose anything with this tiptap upgrade.
Impressive work!
89f0967 to
dbd086d
Compare
|
The keyboard shortcuts for strikethrough changed upstream (Ctrl-Shift-X instead of Ctrl-D). We either have to overwrite it or (imho better) keep it the upstream way and update our documentation. |
Hehe... Actually this caught an issue in the error handling. Before we were catching errors in the PollingBackend like this: This caused exceptions in handleResponse to be caught by the catch that was meant for network issues. Now when errors happened they would be handled by So in the end i changed this to: This will either handle the response or the errors - but not both. |
Same is true for shortcuts for headings (Ctrl-Alt-[1-6] instead of Ctrl-Shift-[1-6]). |
ac5d187 to
84d2535
Compare
Ctrl-D is creating a bookmark in firefox by default. I don't think we should overwrite that. I don't use it - but seems to be a very core browser functionality. In libreoffice ctrl-D is double underline. Strike through has no keyboard shortcut by default. |
Thanks for further looking into this. I can imagine that's the reason why TipTap switched from Ctrl-D to Ctrl-Shift-X and I think that we should follow. So only the shortcut documentation in |
ed5d0d1 to
70b34b6
Compare
Migrate the entire editor to tiptap v2. Some changes were introduces that go beyond just using the new tiptap API: *Collaboration* Port tiptap1 collaboration. We still want to use our session and sync mechanism. *Serialization* Add Markdown extension to handle serialization. Tiptap config extensions are not automatically added to the prosemirror schema anymore. The extension adds the `toMarkdown` config value to the prosemirror schema. With the new naming scheme tiptap nodes for a number of elements do not match the prosemirror names. Camelcase the marks and nodes from `defaultMarkdownSerializer` so they match the tiptap names. *Menubar* * Specify args for isActive function directly rather than setting a function. * Make use of the editor instance inside the MenuBar component. * Use the editor rather than slots for command, focused etc. * disable icons based on editor.can * Show menubar as long as submenus are open. When opening a submenu of the menubar keep track of the open menu even for the image and the remaining action menu. Also refocus the editor whenever a submenu is closed. *MenuBubble* Let tippy handle the positioning Tippy is really good at positioning the menu bubble. Remove all our workarounds and let it do its thing. In order for this to work the content of the MenuBubble actually needs to live inside the tippy-content. Tippy bases its calculations on the width of tippy-content. So if we have the content hanging in a separate div with absolute positioning tippy-content will be 0x0 px and not represent the actual width of the menu bubble. *Upgrade image node and ImageView.* Quite a bit of the syntax changed. We now need a wrapping `<node-view-wrapper>` element. Pretty good docs at https://tiptap.dev/guide/node-views/vue#render-a-vue-component We also need to handle the async action. It will run the action on it's own. So in `clickIcon()` we need to test if the action returned anything. Tiptap v1 had inline images. v2 keeps them outside of paragraphs by default. Configure Image node to use inline images as markdownit creates inline images right now. *Trailing Node* Tiptap v2 does not ship the trailing node extension anymore. Included the one from the demos and turned it from typescript into javascript. *Tests* In order to isolate some problems tests were added. The tests in Undeline.spec.js were green right from the beginning. They are not related to the fix and only helped isolate the problem. Also introduced a cypress test for Lists that tests the editor without rendering the page and logging in. It is very fast and fairly easy to write. *Refactorings* * Split marks into separate files. Signed-off-by: Max <[email protected]>
Signed-off-by: Max <[email protected]>
Signed-off-by: Max <[email protected]>
Lowlight 2.4.1 was causing failures with jest. Jest was unhappy with it being an ESM module: https://github.com/nextcloud/text/runs/5089748945 Do not hand around the lowlight global between EditorFactory and EditorWrapper. Tiptaps CodeBlockLowLight does not need it anyway. Signed-off-by: Max <[email protected]>
Signed-off-by: Max <[email protected]>
Either handle network errors or the response. There are three ways to handle errors and responses with axios: ``` axios.post(...).then(...).catch(...) axios.post(...).catch(...).then(...) axios.post(...).then(onResponse, onErr) ``` Use the last one. First one will catch errors triggered by the emits in the happy path with the network error handling. Second one will handle the response, even if errors have been caught. Signed-off-by: Max <[email protected]>
Tiptap v2 changed some defaults for the keyboard shortcuts. * use new default ctrl+shift+X for strike through. Old ctrl+d is used to create bookmarks in firefox. * Keep old ctrl+shift+1 ... ctrl+shift+6 for headings. No reason to change as far as i can tell. Also more consistent with lists (ctrl+shift+7/8). * Change ordered lists to ctrl+shift+7. New default from tiptap. This way it comes right after the headings. Signed-off-by: Max <[email protected]>
70b34b6 to
87aa069
Compare
juliusknorr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work 👍 Lets get this in
| const modules = {} | ||
| for (let i = 0; i < languages.length; i++) { | ||
| const list = listLanguages() | ||
| console.info(list) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a debugging leftover ;)
Summary
This is still work in progress.
PollingBackend:fetchStepsNetwork error when fetching steps, retry 1