Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 21 10:28
    panlee821 edited #1237
  • Jan 21 10:28
    panlee821 opened #1237
  • Jan 21 05:35
    kepta closed #1220
  • Jan 20 22:32
    kachkaev commented #1220
  • Jan 19 11:40
    Narretz edited #1236
  • Jan 19 11:34
    Narretz edited #1236
  • Jan 19 11:32
    Narretz opened #1236
  • Jan 17 11:50

    marijnh on master

    Support an --edit arg to pm rel… (compare)

  • Jan 17 10:48
    marijnh commented #1235
  • Jan 17 10:48
    marijnh closed #1235
  • Jan 17 10:23
    shlroland edited #1235
  • Jan 17 10:22
    shlroland opened #1235
  • Jan 13 15:57
    floriankrueger commented #1233
  • Jan 13 15:32
    marijnh closed #1234
  • Jan 13 15:32
    marijnh commented #1234
  • Jan 13 10:46
    luke-john-atlassian commented #1234
  • Jan 13 09:19
    marijnh commented #1234
  • Jan 13 01:09
    luke-john-atlassian opened #1234
  • Jan 11 23:24
    marijnh commented #1233
  • Jan 11 17:54
    benasher44 commented #1233
denny
@dennyluan
hello is there an easy way to merge two editor states?
say that I'm trying to create an updated EditorState from react props changing
or is it better to just make the editorstate receiveTransaction() on whatever the diff is?
denny
@dennyluan
Sarvar Dhillon
@SarvarD

Hi, I have what's likely a very silly question but haven't been able to find docs/similar recent Gitter posts. I'm trying to write tests for my inputrules by simulating user text input. I first tried @marijnh's suggestion here to no avail - I found using the view.someProp(handleTextInput) with text that matches input rule regex triggers basic input rules, but using that same function with text that doesn't trigger any input rules doesn't update the view's state at all. I've also tried copying pieces of the tests from prosemirror-view (and using the compose function) and am able to edit the DOM, but it doesn't seem like those DOM edit events are being propagated to the view.

My question is: what's the recommended way to simulate users entering input for the purposes of integration testing?

Marijn Haverbeke
@marijnh
You could either make your test asynchronous, so that the mutation observer fires, or call view.domObserver.flush() to force synchronous reading from the DOM. That's not part of the public interface, but should be stable enough for a test.
Shaun Grady
@shaungrady
Hi y'all. Is it possible to force the order of node content? I want to create a definition list with a single DT first, then one or more DL's; e.g., content: 'DT{1} DL{1,}'
Shaun Grady
@shaungrady
OK, got it implemented, now I see why no one replied. πŸ˜› Just wasn't specified in the docs.
Sarvar Dhillon
@SarvarD
@shaungrady, how'd you do it?
2 replies
Sarvar Dhillon
@SarvarD

@marijnh, thanks for the advice. I've been tinkering with this for a few days, and the async approach seems to work (wrapping my assertion in a setTimeout). However, i'd really like to get this to work synchronously via the flush call. Right now, that call is failing to mark the docview as dirty (domobserver.js line 173) because from is always -1. I suspect this is due to my test environment using jsdom, and jsdom not having implementations of certain functions like getClientRects, getBoundingClientRect. Because markDirty doesn't get called, we skip the updateState call on line 177.

I don't follow how the prosemirror-view tests emulate a browser env, and think that's the piece i'm missing here to get things working synchronously. Apologies if my debugging here is totally off, and thanks for the help so far

1 reply
Marijn Haverbeke
@marijnh
Oh, no, running the view on JSDOM is definitely not going to work. I'm surprised it didn't crash on some missing API right away.
1 reply
The library's own tests don't emulate a browser env, they run in a full browser.
marek-baranowski
@marek-baranowski
This message was deleted
Andrew Kirwin
@amk221

If I paste a list item, with no content <li></li>, because my schema says paragraph block*, I end up with <li><p></p></li> πŸ‘πŸ»

But, if I do exactly the same with a <td></td>, I end up with <td></td>

Any ideas why the p isn't created?

Marijn Haverbeke
@marijnh
If the schema restriction exists (probably something like content: block+ for table cells), then you should get some block in there. If it doesn't add one, that sounds like a bug, and an issue report with reproduction instructions would be useful.
Andrew Kirwin
@amk221
I thought it might, ok I'll create a reproduction thanks
Marijn Haverbeke
@marijnh
fromJSON does not validate or check schema constraints, so if you feed it an invalid document, it'll give you an invalid node. You can call .check() on a node if you're not sure that it conforms to the schema.
Andrew Kirwin
@amk221
Thanks, you've taught me about .check()before πŸ‘πŸ»
I've refactored my reproduction to not use .fromJSON
https://codesandbox.io/s/prosemirror-table-cell-content-jxiev?file=/index.html. And td still does not get a paragraph
Marijn Haverbeke
@marijnh
That was a bug. ProseMirror/prosemirror-view@3be4284 should help
Andrew Kirwin
@amk221
πŸ’›
Rishikesh Tirumala
@rishter

Hi! I'm trying to understand if there's a way to serialize comments in a node's toDOM, so that they render when the content is unserialized? Looking in DOMSerializer but open to any tips.

Rendering nodes in email, and it's very helpful to have conditional comments to support VML for outlook compatibility. Thank you!

Rishikesh Tirumala
@rishter
^ we found a solution here, threw a document.createComment('text') in instead of the node we wanted to generate
Andrew Kirwin
@amk221
I'm making a plugin that uses transformPasted. I need to utilise state.tr.setMeta (and pluginKey.getState), to store some information about what was pasted, but at that point in time (inside transformPasted), they don't appear to be accessible in the scope or arguments available. Is my approach wrong here?
Marijn Haverbeke
@marijnh
transformPasted can only modify the parsed content, not do anything else (no transaction has even been created yet when it is called). You may have to use handlePaste instead.
Andrew Kirwin
@amk221
thanks πŸ‘€
a1c9lll
@a1c9lll
I've created a simple browser build for markdown only which you can find here: https://github.com/a1c9lll/prosemirror-markdown-browser-build
Behnaz
@Behnazz
Hi!, I am trying to have some draggable block paragraphs (children)inside another draggable block(parent). but the children are clanky. when I have three or more children I can't drag and drop the middle child above first or below the last child here is a code sandbox link, sand box link really appreciate if anyone can help
nikithompson
@nikithompson
Hi!, I am trying to have some draggable block paragraphs (children)inside another draggable block(parent). but the children are clanky. when I have three or more children I can't drag and drop the middle child above first or below the last child here is a code sandbox link, geometry dash really appreciate if anyone can help
glad that you asked. I also want to find the solution too
Marijn Haverbeke
@marijnh
Your sandbox link goes to a game. The one you posted on the forum went to a sandbox that wouldn't run due to a script error.
Andrew Kirwin
@amk221

I have a position: sticky element inside the a scrollable area, that contains a prosemirror instance. When I use .scrollIntoView() the element is scrolled into view as expected, but it is behind the sticky element.

Is there the possibility of adding similar options to scrollIntoView like: https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
so that I can have more control over the spacing around what 'into view' means?

Marijn Haverbeke
@marijnh
It seems none of those options would help here. CodeMirror 6 has a scrollMargins field that plugins can use to inform the editor about invisible space at the side of the viewport. Maybe something like that (it would be a prop in ProseMirror) could help here?
Andrew Kirwin
@amk221

Yes something similar to that could help.

πŸ€” But, would { block: 'center' } not work? So the element in question ends up being in the center of prosemirror, rather than the bottom (where it happens to be covered up). Here is a video explaining: https://share.getcloudapp.com/z8uknRGy

Marijn Haverbeke
@marijnh
That would work, if centering is what you want and the sticky element covers less than half of the editor. It should be possible to implement custom scroll behavior with just coordsAtPos and directly manipulating the editor's scroll position.
Jefferson Nilo
@jeffyzxc
hey
where i can find the plugins for prosemirror?
Amol Joshi
@Amol023
hello prosemirror pros! I am blocked trying to figure out if it's possible to REPLACE text (but only in the view, using widgets)?
from what I read - the inline decoration allows you to style/modify the text while the widget decoration allows you to add a node. My use-case is to replace a piece of text in the view
Marijn Haverbeke
@marijnh
No, decorations can't replace text. But you can style a bit of text with an inline decoration giving it display: none, and then put a widget next to it.
Amol Joshi
@Amol023
Ooo that could work
Thank you Marijn
Screen Shot 2022-01-22 at 12.22.23 AM.png
really liking how our RTE looks now