-
-
Notifications
You must be signed in to change notification settings - Fork 841
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
Issue when writing a post: ctrl + z issue #1782
Comments
I'm not entirely sure but isn't this the responsibility of the browser or os? |
Is not the browser i am trying on other forums (not Flarum) and is working as expected... so i can undone more than the last edit done. The issue is present only on Flarum. |
Maybe be related to the two-way bindings of Mithril that could interfere with the browser cancel feature ? Can someone test how it behaves in other browsers ? Do we see the same issue ? |
@clarkwinkelmann tested now and it's the same with Chrome |
I can confirm this behavior as well. It appears that a linebreak cuts the ability to ctrl-z undo before the linebreak. Anything on the same line/paragraph has full ctrl-z/shift-ctrl-z capabilities afaict. |
Could this be caused by the markdown toolbar? |
Hi @franzliedke , maybe from some test seems can be the markdown tried with and without and seems ctrl + z is working better without. |
If jahudka/mdarea#4 is implemented, that should resolve this issue. |
Hi, I'm the developer of |
If we end up offering a full WYSIWYG editor via-extension in #2566, I think we can consider this effectively fixed. |
Hi, I've looked into this again and I'm afraid it's even harder to fix than I thought.. I've tried going the route we discussed in the |
Actually, you know what? I've solved it. 😂😂😂 I couldn't help myself 😂 Check out |
The new Typescript version looks great! The class-based refactoring in particular means it should be very extensible, which works great with our extension api! We're hoping to redesign our editor system a bit to allow customization of the editor via drivers, and with that, I'm hoping to bring Flarum's use of mdarea from markdown into core for the basic editor, since the list editor is quite useful regardless of markdown (and we might want to reintroduce some inlines like quotes and backticks). That being said, the undo seems to act up a bit as transactions stack up: if I type some lines, then delete something, it doesn't restore correctly, or tries to copy-paste the entire contents of the text editor. |
Hey, sorry for the delay, thanks for the feedback, I've tested it pretty extensively before publishing version 2.0, I don't know how I could've missed this.. anyway, could you please try the demo now? I've changed some more stuff & tested that the demo works in all the major browsers. As for the extensibility - mdarea isn't very extensible right now, I'm afraid. The class is mainly the API visible from the outside; internally most work is done by closures which you can't easily replace from the outside. The reason for this is that I've been trying to bring down the package size as much as possible - so I've been avoiding class methods and properties (because they'd need |
Wow, it's working VERY well, this is awesome! Thank you so much for all your work on this. Thinking over it again, I don't think there's anything in particular we'd need to extend; I want to include it in core because the markdown it supports semantically makes sense without formatting, so it's overall a much nicer typing experience. And add-ons to markdown that wouldn't be supported by mdarea by default generally don't really retain that semantic benefit. |
Hey, I've made a couple more updates - mostly to allow mdarea to have plugins, but I fixed a couple of bugs as well. The plugin API is very minimal, essentially it just calls a plugin method on every keystroke, allowing the plugin to take action before defaulting to the built-in behaviour - but the integration allows plugins to leverage the internal undo stack. The reason I did that is this: https://jahudka.github.io/mdarea/suggest.html It's what I call a minimal UI. It's something I need anyway and I remember reading somewhere that Flarum needs mentions.. this should work for those, among other things. |
We'll need to wait till #2594 is merged to update. In core we instantiate the textarea with the value by passing it in as a mithril attr. This applies the value on every redraw, which throws off mdarea. With the PR I linked, the textarea will be added to the DOM dynamically, which eliminates this issue. Not a bug with mdarea, just noting why we can't update this yet. |
Hi, just one more thing: the "autosuggest" feature linked in the demo above has now been released as a separate package called |
Hi, is normal that if Enable mdarea? is disabled in the Markdown extension for example for the bug reported here #2746 using Ctrl + Z never work? Also from my test seems Ctrl + Y is not supported. Is not possible to resume text. Maybe this issue should be re-opened or you need fix some other things regarding Markdown and regarding Ctrl + Z and Ctrl + Y If you digit in a post: word1 word2 word3 word4 word5 word6 speared by the space than press Ctrl + z the full row is erased. Tested; https://beta.flarum.site PS: Need clear cache every time the " Enable mdarea? " is changed and saved or is not applied to the community. |
Certain operations (like quoting) do not support ctrl+z. This is possible on more advanced editors (eg. the rich text extension), but not on the simple textarea one. |
So I need to try to install https://discuss.flarum.org/d/26455-wysiwyg-rich-text-editor to resolve the impossibility of undo quoting text? How about:
Is also normal that deactivating " Enable mdarea? " give maybe back to the situation that generated this issue? thanks for your help. |
I am unable to replicate this, I'm not quite seeing it in your video. If you type anything (spaces, characters, delete, newline, etc), all Ctrl + Y history will be lost. That's just how text editors work. The same applies in this github editor.
To an extent, that's just how the browser's undo/redo system works. Isn't this the same as in any textarea element? |
With the rich text editor is better, I will keep the plugin... maybe did not solve all issues but you are right.. also here in GitHub the editor is not perfect on undo, etc. Thanks |
Bug Report
Current Behavior
Cannot underdone more than one time message errors with CTRL + Z
Sometime as staff but also as member ( admin and user side ) you need to write a long post.
If you do errors and use ctrl + z for try to go back you can only resume one time...
For example if now i write 5 sentences here (1,2,3,4,5) than need to undone the 5 and 4 and 3 i cannot do with ctrl + z just sentence 5 will be removed.
Now i press ctrl + z i should be able to undone different changes... but is allowed just one.
This can be a big issue as you can done mistakes and you can be unable to solve.
I believe this should be reported on GitHub.
**Current Behavior **
Steps to Reproduce
Go to the editor and write a message with 5 different sentence one for row.
try to undo the last two or three sentence with ctrl + z , you are able to undone just the last changes done. If you are unable to do many undo you can loose work on a long text where you do errors and need undo more than one step.
Expected Behavior
Press ctrl + z and undo the last action, press again and undo another previous action, etc.
Environment
https://discuss.flarum.org/d/20044-issue-when-writing-a-post-ctrl-z-issue
Can be reproduced also on the official Flarum community.
The text was updated successfully, but these errors were encountered: