Comments (8)
The approach to tables that uses a width attribute is likely to be deprecated in the future, in favor of using a plugin with an appendTransaction function to ensure rectangular shape instead of schema-level restrictions (which makes things like colspan and rowspan possible), and such an approach wouldn't have this problem. Maybe you can build your tables like that?
from prosemirror-markdown.
Hmm. Markdown tables don't support colspan, so maybe it makes sense to enforce it at the schema level, but I haven't written any plugins yet so I will have to learn more about transactions to know how that would work. Do you know offhand any plugins that have a similar appendTransaction function that would be worth look at?
from prosemirror-markdown.
The new-style table implementation hasn't been open-sourced yet, but in effect, what it does is scan the document for tables, and for those that aren't rectangular, append a transaction that inserts cells to make them rectangular.
from prosemirror-markdown.
OK. Does that mean on every transaction it is scanning the whole doc to find and validate all the tables? (or is there a way to only scan things that were edited in the last transaction?)
from prosemirror-markdown.
You can write a helper (but it's not part of the library yet) that recursively descends two documents (the one before the transaction and the one after) and skips nodes that are the same in both, in order to make scanning huge document for this kind of consistency issues cheap.
from prosemirror-markdown.
OK, that makes sense.
I do like the behavior that comes with schema constraints; when deleting the contents of a cell, the cell remains in place, and the cursor jumps to the previous cell. Without schema constraints, the cell itself is deleted, meaning the neighbouring cell gets shifted to a different column. Example: https://www.youtube.com/watch?v=JBVVCt_C7tw
from prosemirror-markdown.
Deleting the whole cell when you delete its contents shouldn't happen. How exactly are you deleting it?
I agree that the schema-constraint formulation of table shape is attractive, but it's a pain to parse cleanly (as you found), doesn't generalize well at all, and basically feels like a hack, so I'm not happy with it.
from prosemirror-markdown.
I was deleting the cell contents via backspace. However, I just realized the isolating
key was only added in 0.21.0, and I hadn't seen the update - now the behavior is great.
Even without a plugin / appendTransaction function, I think this should be ok for now - I don't see any obvious ways that a user will end up with an imbalanced table.
Table row-count was only issue so far where I needed lower-level access in the parser so I'll close this now.
from prosemirror-markdown.
Related Issues (20)
- Allow list items to start with other nodes than paragraphs HOT 2
- Unnecessary escape for the period (.) character HOT 3
- Inline code with `<` characters does not parse correctly (html inside inline code) HOT 2
- Unnecessary escape for `#` character HOT 2
- expelEnclosingWhitespace not working with inner links HOT 1
- What is the recommended method to update the src/schema.ts configuration in a project? HOT 1
- Mark's aren't serialized if root node isn't a block container HOT 2
- Markdown-It is not ESM HOT 4
- Punycode is now a hard-dependency? HOT 4
- Numbers in headers HOT 1
- Don' escape `+++` at the start of a line when serializing HOT 1
- Markdown parser combines two or more same autolink into a single anchor element HOT 3
- How to use with Tables? HOT 1
- Export default parser/serializer options HOT 2
- symbol | in table cells HOT 2
- update `MarkdownSerialize.serialize` type to accept `Fragment` HOT 4
- Markdown-it import path does not align with current package HOT 1
- Handling of `softbreak` is weird HOT 4
- HTML entity unescaping on parse can lead to unexpected results on serialize HOT 5
- Add support for passing an extra env dictionary to the `MarkdownSerializer` HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prosemirror-markdown.