-
-
Notifications
You must be signed in to change notification settings - Fork 330
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
document restrictions not enforced #346
Comments
I was able to construct a test case that created a similar error. Please see whether attached patch helps for you. The intended behavior is not for nothing to happen, in cases like this, but rather for something as close as possible to the regular behavior to happen, without breaking the content restrictions. In this case, the title and subtitle will be joined into a title, and a new empty subtitle will be created. (Yes, it's magic. But it's needed to make copy-paste useable in schemas like this. Also, it can be pretty neat, in terms of user interface, to be able to apply classical wysiwyg-style manipulation even in semantically constrained content.) |
@marijnh Now it works if I select part of the title and part of the subtitle and hit backspace (the result being as you described). However, if I put the caret at the very start of the subtitle (collapsed), and hit backspace, it still throws a "Invalid content for node doc" error. The magic is likely ok in this particular case. But I'm not sure this will always be true. And a rule such as "If change is forbidden, nothing happens" is a lot easier to understand than "the editor will try to patch it together in some reasonable manner". So, I'm skeptical for now, but if I don't find any concrete issues with this approach, I can be convinced. |
Yep, that was a different bug. As I mentioned in the forum thread, this causes potential failure cases to pop up everywhere, and it might be a few iterations before I've caught them all. Attached patch should help with the issue you describe. |
Yep, that worked.
Understood. Probably better I file new issues if I find more then. As it is, this particular issue has been fixed. Thanks! |
Given a schema declaration which contains:
Do:
Expected behavior: No change as schema declaration prevents title and subtitle node from merging.
Observed behavior: Title and subtitle nodes are merged and two JavaScript errors are thrown: "Uncaught RangeError: Maximum call stack size exceeded" and "Uncaught Error: Invalid content for node doc"
The text was updated successfully, but these errors were encountered: