@37signals/lexxy 0.9.21 → 0.9.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -19
- package/dist/lexxy.esm.js +24 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A modern rich text editor for Rails.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[Documentation](https://basecamp.github.io/lexxy/docs/) | <mark>[Try it out!](https://basecamp.github.io/lexxy/sandbox/)</mark>
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
@@ -15,24 +15,7 @@ A modern rich text editor for Rails.
|
|
|
15
15
|
- Preview attachments like PDFs and Videos in the editor.
|
|
16
16
|
- Works seamlessly with Action Text, generating the same canonical HTML format it expects for attachments.
|
|
17
17
|
|
|
18
|
-

|
|
19
|
-
|
|
20
|
-
## Documentation
|
|
21
|
-
|
|
22
|
-
Visit the **[documentation site](https://basecamp.github.io/lexxy)**.
|
|
23
|
-
|
|
24
|
-
## Roadmap
|
|
25
|
-
|
|
26
|
-
This is a beta. Here's what's coming next:
|
|
27
|
-
|
|
28
|
-
- [x] Configurable editors in Action Text: Choose your editor like you choose your database.
|
|
29
|
-
- [x] More editing features:
|
|
30
|
-
- [x] Tables
|
|
31
|
-
- [x] Text highlighting
|
|
32
|
-
- [x] Configuration hooks.
|
|
33
|
-
- [x] Standalone JS package: to use in non-Rails environments.
|
|
34
|
-
- [x] Image galleries: The only remaining feature for full Action Text compatibility
|
|
35
|
-
- [ ] Install task that generates the necessary JS and adds stylesheets.
|
|
18
|
+

|
|
36
19
|
|
|
37
20
|
## Contributing
|
|
38
21
|
|
package/dist/lexxy.esm.js
CHANGED
|
@@ -10,7 +10,7 @@ import { registerPlainText } from '@lexical/plain-text';
|
|
|
10
10
|
import { RichTextExtension, $isQuoteNode, QuoteNode, $isHeadingNode, $createHeadingNode, $createQuoteNode, HeadingNode, registerRichText } from '@lexical/rich-text';
|
|
11
11
|
import { $generateNodesFromDOM, $generateHtmlFromNodes } from '@lexical/html';
|
|
12
12
|
import { HistoryExtension } from '@lexical/history';
|
|
13
|
-
import { $isCodeNode, CodeHighlightNode, CodeNode, $createCodeNode, $isCodeHighlightNode, $createCodeHighlightNode,
|
|
13
|
+
import { $isCodeNode, CodeHighlightNode, CodeNode, $createCodeNode, $isCodeHighlightNode, $createCodeHighlightNode, registerCodeHighlighting, normalizeCodeLang, CODE_LANGUAGE_FRIENDLY_NAME_MAP } from '@lexical/code';
|
|
14
14
|
import { TRANSFORMERS, registerMarkdownShortcuts } from '@lexical/markdown';
|
|
15
15
|
import { INSERT_TABLE_COMMAND, $getTableCellNodeFromLexicalNode, TableCellNode, TableNode, TableRowNode, setScrollableTablesActive, registerTablePlugin, registerTableSelectionObserver, TableCellHeaderStates, $insertTableRowAtSelection, $insertTableColumnAtSelection, $deleteTableRowAtSelection, $deleteTableColumnAtSelection, $findTableNode, $getTableRowIndexFromTableCellNode, $getTableColumnIndexFromTableCellNode, $findCellNode, $getElementForTableNode } from '@lexical/table';
|
|
16
16
|
import { marked } from 'marked';
|
|
@@ -7071,6 +7071,26 @@ function $getAllProvisionalParagraphs(rootNode = $getRoot()) {
|
|
|
7071
7071
|
return $descendantsMatching(rootNode.getChildren(), $isProvisionalParagraphNode)
|
|
7072
7072
|
}
|
|
7073
7073
|
|
|
7074
|
+
// Registers code highlighting through the extension system so its node
|
|
7075
|
+
// transforms exist before the initial editor state is applied. Registering
|
|
7076
|
+
// after editor creation misses code blocks loaded from the initial value:
|
|
7077
|
+
// their transform pass has already run, and Lexical's catch-up dirtying
|
|
7078
|
+
// only sees the committed (still empty) state.
|
|
7079
|
+
class CodeHighlightingExtension extends LexxyExtension {
|
|
7080
|
+
get enabled() {
|
|
7081
|
+
return this.editorElement.supportsRichText
|
|
7082
|
+
}
|
|
7083
|
+
|
|
7084
|
+
get lexicalExtension() {
|
|
7085
|
+
return defineExtension({
|
|
7086
|
+
name: "lexxy/code-highlighting",
|
|
7087
|
+
register(editor) {
|
|
7088
|
+
return registerCodeHighlighting(editor)
|
|
7089
|
+
}
|
|
7090
|
+
})
|
|
7091
|
+
}
|
|
7092
|
+
}
|
|
7093
|
+
|
|
7074
7094
|
const TRIX_LANGUAGE_ATTR = "language";
|
|
7075
7095
|
|
|
7076
7096
|
class TrixContentExtension extends LexxyExtension {
|
|
@@ -8591,6 +8611,7 @@ class LexicalEditorElement extends HTMLElement {
|
|
|
8591
8611
|
get baseExtensions() {
|
|
8592
8612
|
return [
|
|
8593
8613
|
ProvisionalParagraphExtension,
|
|
8614
|
+
CodeHighlightingExtension,
|
|
8594
8615
|
HighlightExtension,
|
|
8595
8616
|
TrixContentExtension,
|
|
8596
8617
|
TablesExtension,
|
|
@@ -8998,7 +9019,7 @@ class LexicalEditorElement extends HTMLElement {
|
|
|
8998
9019
|
registerList(this.editor)
|
|
8999
9020
|
);
|
|
9000
9021
|
this.#registerTableComponents();
|
|
9001
|
-
this.#
|
|
9022
|
+
this.#registerCodeLanguagePicker();
|
|
9002
9023
|
if (this.supportsMarkdown) {
|
|
9003
9024
|
const transformers = [ ...TRANSFORMERS, HORIZONTAL_DIVIDER ];
|
|
9004
9025
|
registered.push(
|
|
@@ -9020,8 +9041,7 @@ class LexicalEditorElement extends HTMLElement {
|
|
|
9020
9041
|
this.#disposables.push(tableTools);
|
|
9021
9042
|
}
|
|
9022
9043
|
|
|
9023
|
-
#
|
|
9024
|
-
registerCodeHighlighting(this.editor);
|
|
9044
|
+
#registerCodeLanguagePicker() {
|
|
9025
9045
|
let codeLanguagePicker = this.querySelector("lexxy-code-language-picker");
|
|
9026
9046
|
codeLanguagePicker ??= createElement("lexxy-code-language-picker");
|
|
9027
9047
|
this.append(codeLanguagePicker);
|