Add New Feature #21
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
cursor elementfrom being removed during drag operations, ensuring the continuity of animations liketransition.disableDropCursortype toprosemirror-modelto provide code hints when writingNodeSpec.dropEffectwhendisableDropCursoroption triggered.How about making this the default behavior, instead of an option, and using a fixed class name, so that no configuration is necessary?
I personally think it's fine, but I'm worried that others might not need this behavior. Adding a default class is acceptable. If it's set as the default behavior, I think at least an option should be added, which can default to true. If you agree with me, I'll make the changes. Or do you think anything else is needed?
In what way can this cause problems for existing users? The hiding class would be styled as
display: nonein the styles, which would in almost all circumstances be indistinguishable from being removed from the DOM.I noticed that the Milkdown editor already uses transition animations, following the old behavior. During dragging, the animation breaks. Perhaps they adjusted the animation style based on this breaks. Changing this would make the animation continuous, but it might not be what they intended.
I'm ok with both, your repo, your choice.
Oh, on closer look it seems the package does not use any actual CSS at the moment, so there's no place to define the class that'd hide the cursor. Would a solution that exposes an
inactiveClassoption and just setsdisplay: nonewhen none is defined work for you?Of course
In the latest commit, I added a shouldCalcDropPoint option to sync with my copy/paste plugin. Sometimes, I don't want to calculate the drop point, and my editor forced a change in the code format. I don't really want to revert it, so I hope you don't mind.
I absolutely do mind. PRs with superfluous changes in them are not welcome.
Looking at the code, I'm wondering what kind of situation, in the current code, causes the cursor to be hidden when a drag is still in progress. It seems
setCursor(null)is only called in response todragend/dragleave/dropevents.Ok, i change back the code format
I’m not sure I understand what you mean. Are you saying that the original code doesn’t cause the issue I mentioned, or that the code I submitted is causing the cursor to be hidden during the drag?
I'm sure there was a reason you started on this patch, but I don't see any path in the current code that'll call
setCursor(null)while a drag is still ongoing, so I'd like to hear more about what situation you are addressing here.First, you can see that the drag between the two paragraphs was interrupted because the
dragleaveevent was triggered.Second, when a
NodeSpect'sdisableDropCursoris set to true, thedragleaveevent is also triggered.After change
My English isn't very good. If I say something unclear, feel free to ask me anytime.
I see,
dragleaveis also fired when the drag moves from a node to a descendent. It looks like we could just remove theevent.target == this.editorView.dom ||part from thedragleavehandler, to avoid this unnecessary hiding.I applied this change and found that the only difference compared to what I changed is when dragging outside the editor, which is acceptable. So, I will revert this part of the code. Can the rest of the changes be merged?
With my change, is there any situation left where the cursor is hidden while dragging inside the editor? I.e. are your changes still necessary?
My change still contain two more changes
disableDropCursortype to prosemirror-model to provide code hints when writing NodeSpec.dropEffectwhendisableDropCursoroption triggered.Oh, also a inactive class name and
shouldCalcDropPointoption i mention beforeI think you may be better off forking this extension—I don't really want to add this kind of controls, which would have to be carefully synchronized with a drop handler to make sure the cursor and the actual drop behavior are aligned, to this code.
I've merged the
disableDropCursordeclaration inb4de30cPull request closed