I am hoping to do the same thing with the “Go to line” panel. I am able to style it mostly well enough with pure CSS, but to meet my organization’s style guide we need a slightly different DOM structure.
Would it be possible to do as was done for the search panel, and expose a createPanel option or something to that effect? Even if I had just a mount option, that would be enough to adjust the DOM as needed. I would also prefer a top option as well so it can be aligned to the top just like I have the search panel.
I would recommend you just fork it. It’s only some 80-odd lines. Since the only interface it exposes at the moment is a single command, there’s not a lot of surface for passing in options anyway.
Thanks! I have attempted this and almost have it fully working. My issue is I can’t seem to get the dialogEffect.of( false ) to work, and so I can’t hide the panel after it is shown.
Is the StateEffectType supposed to be in the same scope as the EditorView, or something? I noticed the update() method of the StateField searches for effects in the transaction object, but in my case it never finds a match:
update( value, transaction ) {
for ( let e of transaction.effects ) {
if ( e.is( this.myStateEffectType ) ) {
console.log( 'found', e.value );
value = e.value;
}
}
return value;
},
“found” is never printed to the console in my testing.
I also went off of the CodeMirror Panel Example in my implementation. The example code has create: () => false on the StateField definition, while the gotoLine implementation has create: () => true. I had to use the latter in order for the panel to actually show.
You can now see what I’m talking about by reviewing this demo. After hitting Alt+g, you see the panel (never mind the bad styling), and indeed it works as expected. However, after hitting “Go”, Enter, or Escape, the panel is not hidden. See also the Log for some helpful output.