feat: HTML node (#5107)

*  Create HTML templating node PoC

* ♻️ Apply feedback

* 🐛 Scope CSS selectors

* ✏️ Adjust description

* ✏️ Adjust placeholder

*  Replace two custom files with package output

*  Add `codemirror-lang-html-n8n`

* 👕 Appease linter

* 🧪 Skip event bus tests

*  Revert "Skip event bus tests"

This reverts commit 5702585d0de3b8465660567132e9003e78f1104c.

* ✏️ Update codex

* 🧹 Cleanup

* 🐛 Restore original for `continueOnFail`

*  Improve `getResolvables`
This commit is contained in:
Iván Ovejero
2023-01-26 10:03:13 +01:00
committed by GitHub
parent a1710fbd27
commit 74e6f5d190
25 changed files with 1049 additions and 12 deletions

View File

@@ -29,7 +29,19 @@ const handler = EditorView.inputHandler.of((view, from, to, insert) => {
const transaction = insertBracket(view.state, insert);
if (!transaction) return false;
if (!transaction) {
// customization: brace setup when surrounded by HTML tags: <div></div> -> <div>{| }</div>
if (insert === '{') {
const cursor = view.state.selection.main.head;
view.dispatch({
changes: { from: cursor, insert: '{ }' },
selection: { anchor: cursor + 1 },
});
return true;
}
return false;
}
view.dispatch(transaction);
@@ -90,6 +102,7 @@ const [_, bracketState] = closeBrackets() as readonly Extension[];
* - prevent token autoclosing during autocompletion (exception: `{`),
* - prevent square bracket autoclosing prior to `.json`
* - inject whitespace and braces for resolvables
* - set up braces when surrounded by HTML tags
*
* Other than segments marked `customization`, this is a copy of the [original](https://github.com/codemirror/closebrackets/blob/0a56edfaf2c6d97bc5e88f272de0985b4f41e37a/src/closebrackets.ts#L79).
*/