@blazetrails/actiontext 0.0.0-stage → 0.1.0-alpha0.2

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.
Files changed (155) hide show
  1. package/LICENSE +21 -0
  2. package/app/views/action-text/attachables/_content_attachment.html.tse +3 -0
  3. package/app/views/action-text/attachables/_missing_attachable.html.tse +1 -0
  4. package/app/views/action-text/attachables/_remote_image.html.tse +8 -0
  5. package/app/views/action-text/attachment-galleries/_attachment_gallery.html.tse +3 -0
  6. package/app/views/action-text/contents/_content.html.tse +1 -0
  7. package/app/views/active-storage/blobs/_blob.html.tse +14 -0
  8. package/app/views/layouts/action-text/contents/_content.html.tse +3 -0
  9. package/dist/.trails/views/action-text/attachables/_content_attachment.html.tse.js +35 -0
  10. package/dist/.trails/views/action-text/attachables/_content_attachment.html.tse.js.map +1 -0
  11. package/dist/.trails/views/action-text/attachables/_missing_attachable.html.tse.js +16 -0
  12. package/dist/.trails/views/action-text/attachables/_missing_attachable.html.tse.js.map +1 -0
  13. package/dist/.trails/views/action-text/attachables/_remote_image.html.tse.js +42 -0
  14. package/dist/.trails/views/action-text/attachables/_remote_image.html.tse.js.map +1 -0
  15. package/dist/.trails/views/action-text/attachment-galleries/_attachment_gallery.html.tse.js +37 -0
  16. package/dist/.trails/views/action-text/attachment-galleries/_attachment_gallery.html.tse.js.map +1 -0
  17. package/dist/.trails/views/action-text/contents/_content.html.tse.js +34 -0
  18. package/dist/.trails/views/action-text/contents/_content.html.tse.js.map +1 -0
  19. package/dist/.trails/views/active-storage/blobs/_blob.html.tse.js +57 -0
  20. package/dist/.trails/views/active-storage/blobs/_blob.html.tse.js.map +1 -0
  21. package/dist/.trails/views/layouts/action-text/contents/_content.html.tse.js +18 -0
  22. package/dist/.trails/views/layouts/action-text/contents/_content.html.tse.js.map +1 -0
  23. package/dist/action-text.js +73 -0
  24. package/dist/action-text.js.map +1 -0
  25. package/dist/app/helpers/action-text/content-helper.js +84 -0
  26. package/dist/app/helpers/action-text/content-helper.js.map +1 -0
  27. package/dist/app/helpers/action-text/tag-helper.js +115 -0
  28. package/dist/app/helpers/action-text/tag-helper.js.map +1 -0
  29. package/dist/app/views/action-text/attachables/_content_attachment.html.tse +3 -0
  30. package/dist/app/views/action-text/attachables/_missing_attachable.html.tse +1 -0
  31. package/dist/app/views/action-text/attachables/_remote_image.html.tse +8 -0
  32. package/dist/app/views/action-text/attachment-galleries/_attachment_gallery.html.tse +3 -0
  33. package/dist/app/views/action-text/contents/_content.html.tse +1 -0
  34. package/dist/app/views/active-storage/blobs/_blob.html.tse +14 -0
  35. package/dist/app/views/layouts/action-text/contents/_content.html.tse +3 -0
  36. package/dist/attachable.js +118 -0
  37. package/dist/attachable.js.map +1 -0
  38. package/dist/attachables/content-attachment.js +55 -0
  39. package/dist/attachables/content-attachment.js.map +1 -0
  40. package/dist/attachables/missing-attachable.js +30 -0
  41. package/dist/attachables/missing-attachable.js.map +1 -0
  42. package/dist/attachables/remote-image.js +46 -0
  43. package/dist/attachables/remote-image.js.map +1 -0
  44. package/dist/attachment-gallery.js +64 -0
  45. package/dist/attachment-gallery.js.map +1 -0
  46. package/dist/attachment.js +122 -0
  47. package/dist/attachment.js.map +1 -0
  48. package/dist/attachments/caching.js +17 -0
  49. package/dist/attachments/caching.js.map +1 -0
  50. package/dist/attachments/minification.js +15 -0
  51. package/dist/attachments/minification.js.map +1 -0
  52. package/dist/attachments/trix-conversion.js +37 -0
  53. package/dist/attachments/trix-conversion.js.map +1 -0
  54. package/dist/attribute.js +83 -0
  55. package/dist/attribute.js.map +1 -0
  56. package/dist/constants.action-text-install-install-generator.generated.js +4 -0
  57. package/dist/constants.action-text-install-install-generator.generated.js.map +1 -0
  58. package/dist/constants.encrypted-rich-text.generated.js +4 -0
  59. package/dist/constants.encrypted-rich-text.generated.js.map +1 -0
  60. package/dist/constants.engine.generated.js +4 -0
  61. package/dist/constants.engine.generated.js.map +1 -0
  62. package/dist/constants.generated.js +53 -0
  63. package/dist/constants.generated.js.map +1 -0
  64. package/dist/constants.rich-text.generated.js +4 -0
  65. package/dist/constants.rich-text.generated.js.map +1 -0
  66. package/dist/content.js +162 -0
  67. package/dist/content.js.map +1 -0
  68. package/dist/db/migrate/20180528164100_create_action_text_tables.js +31 -0
  69. package/dist/db/migrate/20180528164100_create_action_text_tables.js.map +1 -0
  70. package/dist/deprecator.js +8 -0
  71. package/dist/deprecator.js.map +1 -0
  72. package/dist/encrypted-rich-text.js +12 -0
  73. package/dist/encrypted-rich-text.js.map +1 -0
  74. package/dist/encryption.js +56 -0
  75. package/dist/encryption.js.map +1 -0
  76. package/dist/engine.js +125 -0
  77. package/dist/engine.js.map +1 -0
  78. package/dist/fixture-set.js +14 -0
  79. package/dist/fixture-set.js.map +1 -0
  80. package/dist/fragment.js +59 -0
  81. package/dist/fragment.js.map +1 -0
  82. package/dist/gem-version.js +18 -0
  83. package/dist/gem-version.js.map +1 -0
  84. package/dist/generators/action-text/install/install-generator.js +88 -0
  85. package/dist/generators/action-text/install/install-generator.js.map +1 -0
  86. package/dist/generators/action-text/install/templates/actiontext.css.tt +440 -0
  87. package/dist/generators/action-text/install/templates/actiontext.css.tt.js +12 -0
  88. package/dist/html-conversion.js +21 -0
  89. package/dist/html-conversion.js.map +1 -0
  90. package/dist/index.js +22 -0
  91. package/dist/index.js.map +1 -0
  92. package/dist/plain-text-conversion.js +126 -0
  93. package/dist/plain-text-conversion.js.map +1 -0
  94. package/dist/record.js +11 -0
  95. package/dist/record.js.map +1 -0
  96. package/dist/rendering.js +35 -0
  97. package/dist/rendering.js.map +1 -0
  98. package/dist/rich-text.js +70 -0
  99. package/dist/rich-text.js.map +1 -0
  100. package/dist/serialization.js +30 -0
  101. package/dist/serialization.js.map +1 -0
  102. package/dist/system-test-helper.js +38 -0
  103. package/dist/system-test-helper.js.map +1 -0
  104. package/dist/tasks/actiontext.rake.js +8 -0
  105. package/dist/tasks/actiontext.rake.js.map +1 -0
  106. package/dist/trails/generators/test-unit/install/install-generator.js +16 -0
  107. package/dist/trails/generators/test-unit/install/install-generator.js.map +1 -0
  108. package/dist/trails/generators/test-unit/install/templates/fixtures.yml.tt +4 -0
  109. package/dist/trails/generators/test-unit/install/templates/fixtures.yml.tt.js +12 -0
  110. package/dist/trix-attachment.js +105 -0
  111. package/dist/trix-attachment.js.map +1 -0
  112. package/dist/types/action-text.d.ts +75 -0
  113. package/dist/types/app/helpers/action-text/content-helper.d.ts +35 -0
  114. package/dist/types/app/helpers/action-text/tag-helper.d.ts +48 -0
  115. package/dist/types/attachable.d.ts +41 -0
  116. package/dist/types/attachables/content-attachment.d.ts +30 -0
  117. package/dist/types/attachables/missing-attachable.d.ts +9 -0
  118. package/dist/types/attachables/remote-image.d.ts +23 -0
  119. package/dist/types/attachment-gallery.d.ts +23 -0
  120. package/dist/types/attachment.d.ts +51 -0
  121. package/dist/types/attachments/caching.d.ts +15 -0
  122. package/dist/types/attachments/minification.d.ts +5 -0
  123. package/dist/types/attachments/trix-conversion.d.ts +17 -0
  124. package/dist/types/attribute.d.ts +27 -0
  125. package/dist/types/constants.action-text-install-install-generator.generated.d.ts +2 -0
  126. package/dist/types/constants.encrypted-rich-text.generated.d.ts +2 -0
  127. package/dist/types/constants.engine.generated.d.ts +2 -0
  128. package/dist/types/constants.generated.d.ts +2 -0
  129. package/dist/types/constants.rich-text.generated.d.ts +2 -0
  130. package/dist/types/content.d.ts +73 -0
  131. package/dist/types/db/migrate/20180528164100_create_action_text_tables.d.ts +9 -0
  132. package/dist/types/deprecator.d.ts +3 -0
  133. package/dist/types/encrypted-rich-text.d.ts +5 -0
  134. package/dist/types/encryption.d.ts +30 -0
  135. package/dist/types/engine.d.ts +28 -0
  136. package/dist/types/fixture-set.d.ts +6 -0
  137. package/dist/types/fragment.d.ts +19 -0
  138. package/dist/types/gem-version.d.ts +10 -0
  139. package/dist/types/generators/action-text/install/install-generator.d.ts +25 -0
  140. package/dist/types/html-conversion.d.ts +9 -0
  141. package/dist/types/index.d.ts +22 -0
  142. package/dist/types/plain-text-conversion.d.ts +41 -0
  143. package/dist/types/record.d.ts +4 -0
  144. package/dist/types/rendering.d.ts +15 -0
  145. package/dist/types/rich-text.d.ts +24 -0
  146. package/dist/types/serialization.d.ts +25 -0
  147. package/dist/types/system-test-helper.d.ts +18 -0
  148. package/dist/types/tasks/actiontext.rake.d.ts +2 -0
  149. package/dist/types/trails/generators/test-unit/install/install-generator.d.ts +5 -0
  150. package/dist/types/trix-attachment.d.ts +33 -0
  151. package/dist/types/version.d.ts +3 -0
  152. package/dist/version.js +7 -0
  153. package/dist/version.js.map +1 -0
  154. package/package.json +71 -3
  155. package/README.md +0 -3
@@ -0,0 +1,126 @@
1
+ import { camelize, isBlank } from "@blazetrails/activesupport";
2
+ import { chomp, rbObjRespondTo } from "@blazetrails/ruby-compat";
3
+ import { ActionText } from "./action-text.js";
4
+ export const PlainTextConversion = {
5
+ nodeToPlainText(node) {
6
+ return this.removeTrailingNewlines(this.plainTextForNode(node));
7
+ },
8
+ /** @internal */
9
+ plainTextForNode(node, index = 0) {
10
+ if (rbObjRespondTo(this, this.plainTextMethodForNode(node))) {
11
+ return this[this.plainTextMethodForNode(node)](node, index);
12
+ }
13
+ else {
14
+ return this.plainTextForNodeChildren(node);
15
+ }
16
+ },
17
+ /** @internal */
18
+ plainTextForNodeChildren(node) {
19
+ const texts = [];
20
+ node.children.toA().forEach((child, index) => {
21
+ texts.push(this.plainTextForNode(child, index));
22
+ });
23
+ return texts.join("");
24
+ },
25
+ /** @internal */
26
+ plainTextMethodForNode(node) {
27
+ return `plainTextFor${camelize(String(node.name))}Node`;
28
+ },
29
+ /** @internal */
30
+ plainTextForBlock(node, _index = 0) {
31
+ return `${this.removeTrailingNewlines(this.plainTextForNodeChildren(node))}\n\n`;
32
+ },
33
+ /** @internal */
34
+ plainTextForList(node, _index) {
35
+ return `${this.breakIfNestedList(node, this.plainTextForBlock(node))}`;
36
+ },
37
+ /** @internal */
38
+ plainTextForBrNode(_node, _index) {
39
+ return "\n";
40
+ },
41
+ /** @internal */
42
+ plainTextForTextNode(node, _index) {
43
+ return this.removeTrailingNewlines(node.text);
44
+ },
45
+ /** @internal */
46
+ plainTextForDivNode(node, _index) {
47
+ return `${this.removeTrailingNewlines(this.plainTextForNodeChildren(node))}\n`;
48
+ },
49
+ /** @internal */
50
+ plainTextForFigcaptionNode(node, _index) {
51
+ return `[${this.removeTrailingNewlines(this.plainTextForNodeChildren(node))}]`;
52
+ },
53
+ /** @internal */
54
+ plainTextForBlockquoteNode(node, _index) {
55
+ let text = this.plainTextForBlock(node);
56
+ if (isBlank(text))
57
+ return "“”";
58
+ const rindex = [...text.matchAll(/\S/g)].at(-1).index + 1;
59
+ text = `${text.slice(0, rindex)}”${text.slice(rindex)}`;
60
+ const index = text.search(/\S/);
61
+ text = `${text.slice(0, index)}“${text.slice(index)}`;
62
+ return text;
63
+ },
64
+ /** @internal */
65
+ plainTextForLiNode(node, index) {
66
+ const bullet = this.bulletForLiNode(node, index);
67
+ const text = this.removeTrailingNewlines(this.plainTextForNodeChildren(node));
68
+ const indentation = this.indentationForLiNode(node);
69
+ return `${indentation ?? ""}${bullet} ${text}\n`;
70
+ },
71
+ /** @internal */
72
+ removeTrailingNewlines(text) {
73
+ return chomp(text, "");
74
+ },
75
+ /** @internal */
76
+ bulletForLiNode(node, index) {
77
+ if (this.listNodeNameForLiNode(node) === "ol") {
78
+ return `${index + 1}.`;
79
+ }
80
+ else {
81
+ return "•";
82
+ }
83
+ },
84
+ /** @internal */
85
+ listNodeNameForLiNode(node) {
86
+ for (const ancestor of node.ancestors()) {
87
+ if (/^[uo]l$/.test(ancestor.name))
88
+ return ancestor.name;
89
+ }
90
+ return null;
91
+ },
92
+ /** @internal */
93
+ indentationForLiNode(node) {
94
+ const depth = this.listNodeDepthForNode(node);
95
+ if (depth > 1) {
96
+ return " ".repeat(depth - 1);
97
+ }
98
+ return null;
99
+ },
100
+ /** @internal */
101
+ listNodeDepthForNode(node) {
102
+ return node
103
+ .ancestors()
104
+ .map((ancestor) => ancestor.name)
105
+ .filter((name) => /^[uo]l$/.test(name)).length;
106
+ },
107
+ /** @internal */
108
+ breakIfNestedList(node, text) {
109
+ if (this.listNodeDepthForNode(node) > 0) {
110
+ return `\n${text}`;
111
+ }
112
+ else {
113
+ return text;
114
+ }
115
+ },
116
+ };
117
+ for (const element of ["h1", "p"]) {
118
+ PlainTextConversion[`plainTextFor${camelize(element)}Node`] =
119
+ PlainTextConversion.plainTextForBlock;
120
+ }
121
+ for (const element of ["ul", "ol"]) {
122
+ PlainTextConversion[`plainTextFor${camelize(element)}Node`] =
123
+ PlainTextConversion.plainTextForList;
124
+ }
125
+ ActionText.PlainTextConversion = PlainTextConversion;
126
+ //# sourceMappingURL=plain-text-conversion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plain-text-conversion.js","sourceRoot":"","sources":["../lib/plain-text-conversion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAEjE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAI9C,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,eAAe,CAAC,IAAmB;QACjC,OAAO,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;IAClE,CAAC;IAED,gBAAgB;IAChB,gBAAgB,CAAC,IAAmB,EAAE,KAAK,GAAG,CAAC;QAC7C,IAAI,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;YAC5D,OAAQ,IAAmD,CACzD,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAClC,CAAC,IAAa,EAAE,KAAK,CAAC,CAAC;QAC1B,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAC,wB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,IAAe,EAAE,IAAY;QAC7C,IAAI,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACxC,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CACF,CAAC;AAIF,KAAK,MAAM,OAAO,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;IACjC,mBAA+C,CAAC,eAAe,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC;QACtF,mBAAmB,CAAC,iBAAiB,CAAC;AAC1C,CAAC;AAED,KAAK,MAAM,OAAO,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;IAClC,mBAA+C,CAAC,eAAe,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC;QACtF,mBAAmB,CAAC,gBAAgB,CAAC;AACzC,CAAC;AAED,UAAU,CAAC,mBAAmB,GAAG,mBAAmB,CAAC"}
package/dist/record.js ADDED
@@ -0,0 +1,11 @@
1
+ import { Base } from "@blazetrails/activerecord";
2
+ import { runLoadHooks } from "@blazetrails/activesupport";
3
+ import { ActionText } from "./action-text.js";
4
+ export class Record extends Base {
5
+ static {
6
+ this.abstractClass = true;
7
+ }
8
+ }
9
+ runLoadHooks("action_text_record", Record);
10
+ ActionText.Record = Record;
11
+ //# sourceMappingURL=record.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"record.js","sourceRoot":"","sources":["../lib/record.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,OAAO,MAAO,SAAQ,IAAI;IAC9B;QACE,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAC5B,CAAC;CACF;AAED,YAAY,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;AAC3C,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { ActionController } from "@blazetrails/actionpack";
2
+ import { Concern, delegate, extend, IsolatedExecutionState, threadCattrAccessor, threadMattrKey, } from "@blazetrails/activesupport";
3
+ import { rbEnsure } from "@blazetrails/ruby-compat";
4
+ import { ActionText } from "./action-text.js";
5
+ export const Rendering = {};
6
+ extend(Rendering, Concern);
7
+ Rendering.included(null, function () {
8
+ threadCattrAccessor.call(this, "renderer", { instanceAccessor: false });
9
+ delegate.call(this.prototype, "render", { to: "class" });
10
+ });
11
+ Rendering.classMethods((mod) => {
12
+ mod.actionControllerRenderer = function () {
13
+ if (Object.hasOwn(this, "_actionControllerRenderer"))
14
+ return this._actionControllerRenderer;
15
+ return (this._actionControllerRenderer = class extends ActionController.Base {
16
+ }.renderer);
17
+ };
18
+ /** @inventedArm fork — PERMANENT */
19
+ mod.withRenderer = function (renderer, block) {
20
+ return IsolatedExecutionState.fork(threadMattrKey(this, "renderer"), () => {
21
+ const previousRenderer = this.renderer;
22
+ return rbEnsure(() => {
23
+ this.renderer = renderer;
24
+ return block();
25
+ }, () => {
26
+ this.renderer = previousRenderer;
27
+ });
28
+ });
29
+ };
30
+ mod.render = function (...args) {
31
+ return (this.renderer ?? this.actionControllerRenderer()).renderToString(...args);
32
+ };
33
+ });
34
+ ActionText.Rendering = Rendering;
35
+ //# sourceMappingURL=rendering.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rendering.js","sourceRoot":"","sources":["../lib/rendering.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EACL,OAAO,EACP,QAAQ,EACR,MAAM,EACN,sBAAsB,EACtB,mBAAmB,EACnB,cAAc,GAEf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,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AM,GAAG,UAAgC,GAAG,IAAe;QAC7D,OAAO,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,wBAAwB,EAAE,CAAC,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,CAAC;IACpF,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC;AASH,UAAU,CAAC,SAAS,GAAG,SAAS,CAAC"}
@@ -0,0 +1,70 @@
1
+ import "./constants.rich-text.generated.js";
2
+ import { runLoadHooks } from "@blazetrails/activesupport";
3
+ import { ActiveStorage } from "@blazetrails/activestorage";
4
+ import { _loadSerializedAttributes } from "@blazetrails/activerecord";
5
+ import { isBlank, isPresent } from "@blazetrails/activesupport";
6
+ import { RuntimeError, uniq } from "@blazetrails/ruby-compat";
7
+ import { ActionText } from "./action-text.js";
8
+ import { Content } from "./content.js";
9
+ import { Record } from "./record.js";
10
+ export class RichText extends Record {
11
+ /**
12
+ * @internal
13
+ * @noRailsEquivalent PERMANENT
14
+ */
15
+ _plainText;
16
+ static {
17
+ this.serialize("body", { coder: Content });
18
+ this.belongsTo("record", { polymorphic: true, touch: true });
19
+ this.hasManyAttached("embeds");
20
+ /** @inventedArm toPlainText — PERMANENT */
21
+ this.beforeSave(async (record) => {
22
+ if (record.body != null && record.body.isPresent()) {
23
+ await record.toPlainText();
24
+ await record.setEmbeds(uniq((await record.body.attachables()).filter((attachable) => attachable instanceof ActiveStorage.Blob)));
25
+ }
26
+ });
27
+ }
28
+ async setBody(body) {
29
+ this.body = body;
30
+ await _loadSerializedAttributes(this);
31
+ }
32
+ toString() {
33
+ return this.body == null ? "" : this.body.toString();
34
+ }
35
+ isNil() {
36
+ return this.body == null;
37
+ }
38
+ async toPlainText() {
39
+ const body = this.body;
40
+ const plainText = String((await body?.toPlainText()) ?? "");
41
+ this._plainText = [body?.toHtml(), plainText];
42
+ return plainText;
43
+ }
44
+ async toTrixHtml() {
45
+ return this.body?.toTrixHtml();
46
+ }
47
+ isEmpty() {
48
+ return this.loadedPlainText() === "";
49
+ }
50
+ /**
51
+ * @internal
52
+ * @noRailsEquivalent PERMANENT
53
+ */
54
+ loadedPlainText() {
55
+ if (this.body == null)
56
+ return "";
57
+ if (this._plainText != null && this._plainText[0] === this.body.toHtml())
58
+ return this._plainText[1];
59
+ throw new RuntimeError("to_plain_text is not loaded; `await richText.toPlainText()` first.");
60
+ }
61
+ }
62
+ RichText.prototype.isBlank = function () {
63
+ return isBlank(this.loadedPlainText());
64
+ };
65
+ RichText.prototype.isPresent = function () {
66
+ return isPresent(this.loadedPlainText());
67
+ };
68
+ ActionText.RichText = RichText;
69
+ runLoadHooks("action_text_rich_text", RichText);
70
+ //# sourceMappingURL=rich-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rich-text.js","sourceRoot":"","sources":["../lib/rich-text.ts"],"names":[],"mappings":"AAAA,OAAO,oCAAoC,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,OAAO,QAAS,SAAQ,MAAM;IAGlC;;;OAGG;IACK,UAAU,CAAgC;IAElD;QACE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;QAE3C,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,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EAAE,UAAU,EAAE,CAAC;IACjC,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,eAAe,EAAE,KAAK,EAAE,CAAC;IACvC,CAAC;IAED;;;OAGG;IACH,eAAe;QACb,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI;YAAE,OAAO,EAAE,CAAC;QACjC,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YACtE,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC5B,MAAM,IAAI,YAAY,CAAC,oEAAoE,CAAC,CAAC;IAC/F,CAAC;CACF;AAED,QAAQ,CAAC,SAAS,CAAC,OAAO,GAAG;IAC3B,OAAO,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;AACzC,CAAC,CAAC;AACF,QAAQ,CAAC,SAAS,CAAC,SAAS,GAAG;IAC7B,OAAO,SAAS,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;AAC3C,CAAC,CAAC;AAEF,UAAU,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAE/B,YAAY,CAAC,uBAAuB,EAAE,QAAQ,CAAC,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { Concern, extend } from "@blazetrails/activesupport";
2
+ import { ActionText } from "./action-text.js";
3
+ function load(content) {
4
+ if (content != null && content !== false)
5
+ return this.new(content);
6
+ return null;
7
+ }
8
+ function dump(content) {
9
+ if (content == null) {
10
+ return null;
11
+ }
12
+ else if (content instanceof this) {
13
+ return content.toHtml();
14
+ }
15
+ else if (content instanceof ActionText.RichText) {
16
+ return content.body.toHtml();
17
+ }
18
+ else {
19
+ return this.new(content).then((content_) => content_.toHtml());
20
+ }
21
+ }
22
+ const ClassMethods = { load, dump, _load: load };
23
+ function _dump(..._args) {
24
+ return this.constructor.dump(this);
25
+ }
26
+ export const Serialization = { _dump };
27
+ extend(Serialization, Concern);
28
+ Serialization.ClassMethods = ClassMethods;
29
+ ActionText.Serialization = Serialization;
30
+ //# sourceMappingURL=serialization.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serialization.js","sourceRoot":"","sources":["../lib/serialization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAiB,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAO9C,SAAS,IAAI,CAA0B,OAAgB;IACrD,IAAI,OAAO,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACnE,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,IAAI,CAA0B,OAAgB;IACrD,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;SAAM,IAAI,OAAO,YAAa,IAA2D,EAAE,CAAC;QAC3F,OAAO,OAAO,CAAC,MAAM,EAAE,CAAC;IAC1B,CAAC;SAAM,IAAI,OAAO,YAAY,UAAU,CAAC,QAAS,EAAE,CAAC;QACnD,OAAO,OAAO,CAAC,IAAK,CAAC,MAAM,EAAE,CAAC;IAChC,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACjE,CAAC;AACH,CAAC;AAED,MAAM,YAAY,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAEjD,SAAS,KAAK,CAAiC,GAAG,KAAgB;IAChE,OAAQ,IAAI,CAAC,WAAyD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACpF,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,KAAK,EAGnC,CAAC;AACF,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AAC/B,aAAa,CAAC,YAAY,GAAG,YAAY,CAAC;AAC1C,UAAU,CAAC,aAAa,GAAG,aAAa,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { ActionText } from "./action-text.js";
2
+ import { ArgumentError, toS } from "@blazetrails/ruby-compat";
3
+ async function fillInRichTextarea(locator = null, options = {}) {
4
+ if (locator !== null && typeof locator === "object") {
5
+ options = locator;
6
+ locator = null;
7
+ }
8
+ if (!Object.hasOwn(options, "with"))
9
+ throw new ArgumentError("missing keyword: :with");
10
+ let xpath;
11
+ if (locator == null) {
12
+ xpath = ".//trix-editor";
13
+ }
14
+ else {
15
+ const string = locator.includes("'")
16
+ ? `concat('${locator.split("'").join(`', "'", '`)}')`
17
+ : `'${locator}'`;
18
+ const inputLocatedByName = `//input[(./@name = ${string})]/@id`;
19
+ const inputLocatedByLabel = `//label[contains(normalize-space(string(.)), ${string})]/@for`;
20
+ xpath =
21
+ ".//trix-editor[(((((" +
22
+ `./@id = ${string}) or ` +
23
+ `(./@placeholder = ${string})) or ` +
24
+ `(./@aria-label = ${string})) or ` +
25
+ `(./@input = ${inputLocatedByName})) or ` +
26
+ `(./@id = ${inputLocatedByLabel}))]`;
27
+ }
28
+ const page = await this.page();
29
+ await page
30
+ .locator(`xpath=${xpath}`)
31
+ .evaluate((editor, html) => editor.editor.loadHTML(html), toS(options.with));
32
+ }
33
+ export const SystemTestHelper = {
34
+ fillInRichTextarea,
35
+ fillInRichTextArea: fillInRichTextarea,
36
+ };
37
+ ActionText.SystemTestHelper = SystemTestHelper;
38
+ //# sourceMappingURL=system-test-helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system-test-helper.js","sourceRoot":"","sources":["../lib/system-test-helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,0BAA0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C,CAClB,CAAC;AACN,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,kBAAkB;IAClB,kBAAkB,EAAE,kBAAkB;CACvC,CAAC;AAEF,UAAU,CAAC,gBAAgB,GAAG,gBAAgB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { DSL } from "@blazetrails/rake";
2
+ import { block } from "@blazetrails/ruby-compat";
3
+ import { Trails } from "@blazetrails/trailties";
4
+ DSL.desc("Copy over the migration, stylesheet, and JavaScript files");
5
+ DSL.task("action_text:install", block(async () => {
6
+ await Trails.Command.invoke("generate", ["action_text:install"]);
7
+ }));
8
+ //# sourceMappingURL=actiontext.rake.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actiontext.rake.js","sourceRoot":"","sources":["../../lib/tasks/actiontext.rake.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,GAAG,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAC;AACtE,GAAG,CAAC,IAAI,CACN,qBAAqB,EACrB,KAAK,CAAC,KAAK,IAAI,EAAE;IACf,MAAM,MAAM,CAAC,OAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,qBAAqB,CAAC,CAAC,CAAC;AACpE,CAAC,CAAC,CACH,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { File } from "@blazetrails/ruby-compat";
2
+ import { Base } from "@blazetrails/trailties/generators";
3
+ const __dir__ = File.dirname(decodeURIComponent(new URL(import.meta.url).pathname));
4
+ export class InstallGenerator extends Base {
5
+ static {
6
+ this.methodAdded("createTestFiles");
7
+ }
8
+ async createTestFiles() {
9
+ await this.template("fixtures.yml", "test/fixtures/action_text/rich_texts.yml");
10
+ }
11
+ }
12
+ InstallGenerator.sourceRoot(File.expandPath("templates", __dir__));
13
+ Object.defineProperty(InstallGenerator, "name", {
14
+ value: "TestUnit::Generators::InstallGenerator",
15
+ });
16
+ //# sourceMappingURL=install-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install-generator.js","sourceRoot":"","sources":["../../../../../lib/trails/generators/test-unit/install/install-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,mCAAmC,CAAC;AAEzD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,IAAI,GAAG,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;AAEpF,MAAM,OAAO,gBAAiB,SAAQ,IAAI;IACxC;QACE,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,MAAM,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE,0CAA0C,CAAC,CAAC;IAClF,CAAC;CACF;AAED,gBAAgB,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;AAEnE,MAAM,CAAC,cAAc,CAAC,gBAAgB,EAAE,MAAM,EAAE;IAC9C,KAAK,EAAE,wCAAwC;CAChD,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ # one:
2
+ # record: name_of_fixture (ClassOfFixture)
3
+ # name: content
4
+ # body: <p>In a <i>million</i> stars!</p>
@@ -0,0 +1,12 @@
1
+ import { StringIO } from "@blazetrails/ruby-compat";
2
+ async function render(context, locals) {
3
+ const _ob = this.outputBuffer;
4
+ this.outputBuffer.append("# one:\n# record: name_of_fixture (ClassOfFixture)\n# name: content\n# body: <p>In a <i>million</i> stars!</p>\n");
5
+ return _ob;
6
+ }
7
+ export default async function () {
8
+ this.outputBuffer = new StringIO();
9
+ await render.call(this);
10
+ return this.outputBuffer.string();
11
+ }
12
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZml4dHVyZXMueW1sLnR0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZml4dHVyZXMueW1sLnR0Il0sInNvdXJjZXNDb250ZW50IjpbIiMgb25lOlxuIyAgIHJlY29yZDogbmFtZV9vZl9maXh0dXJlIChDbGFzc09mRml4dHVyZSlcbiMgICBuYW1lOiBjb250ZW50XG4jICAgYm9keTogPHA+SW4gYSA8aT5taWxsaW9uPC9pPiBzdGFycyE8L3A+XG4iXSwibWFwcGluZ3MiOiI7QUFBQSxLQUFLLFVBQVUsTUFBTSxDQUFDLE9BQU8sRUFBRSxNQUFNO0lBQUksTUFBTSxHQUFHLEdBQUcsSUFBSSxDQUFDLFlBQVksQ0FBQztJQUFDLElBQUksQ0FBQyxZQUFZLENBQUMsTUFBTSxDQUFDLHdIQUF3SCxDQUFDLENBQUMifQ==
@@ -0,0 +1,105 @@
1
+ import { camelize, TopLevel, underscore } from "@blazetrails/activesupport";
2
+ import { except, excBacktrace, kernelInteger, rbInspect, rbModName, slice, toS, } from "@blazetrails/ruby-compat";
3
+ import { ActionText } from "./action-text.js";
4
+ import { HtmlConversion } from "./html-conversion.js";
5
+ export class TrixAttachment {
6
+ static TAG_NAME = "figure";
7
+ static SELECTOR = "[data-trix-attachment]";
8
+ static COMPOSED_ATTRIBUTES = ["caption", "presentation"];
9
+ static ATTRIBUTES = [
10
+ "sgid",
11
+ "contentType",
12
+ "url",
13
+ "href",
14
+ "filename",
15
+ "filesize",
16
+ "width",
17
+ "height",
18
+ "previewable",
19
+ "content",
20
+ ...TrixAttachment.COMPOSED_ATTRIBUTES,
21
+ ];
22
+ static ATTRIBUTE_TYPES = {
23
+ __proto__: null,
24
+ previewable: (value) => toS(value) === "true",
25
+ filesize: (value) => kernelInteger(toS(value), 0, { exception: false }) ?? value,
26
+ width: (value) => kernelInteger(toS(value), 0, { exception: false }),
27
+ height: (value) => kernelInteger(toS(value), 0, { exception: false }),
28
+ ":default": (value) => toS(value),
29
+ };
30
+ static fromAttributes(attributes) {
31
+ attributes = this.processAttributes(attributes);
32
+ const trixAttachmentAttributes = except(attributes, ...this.COMPOSED_ATTRIBUTES);
33
+ const trixAttributes = slice(attributes, ...this.COMPOSED_ATTRIBUTES);
34
+ const node = HtmlConversion.createElement(this.TAG_NAME);
35
+ node.set("data-trix-attachment", JSON.stringify(trixAttachmentAttributes));
36
+ if (Object.keys(trixAttributes).length > 0) {
37
+ node.set("data-trix-attributes", JSON.stringify(trixAttributes));
38
+ }
39
+ return new this(node);
40
+ }
41
+ /** @internal */
42
+ static processAttributes(attributes) {
43
+ return this.typecastAttributeValues(this.transformAttributeKeys(attributes));
44
+ }
45
+ /** @internal */
46
+ static transformAttributeKeys(attributes) {
47
+ return Object.fromEntries(Object.entries(attributes).map(([key, value]) => [
48
+ camelize(underscore(toS(key)), "lower"),
49
+ value,
50
+ ]));
51
+ }
52
+ /** @internal */
53
+ static typecastAttributeValues(attributes) {
54
+ return Object.fromEntries(Object.entries(attributes).map(([key, value]) => {
55
+ const typecast = this.ATTRIBUTE_TYPES[key] ?? this.ATTRIBUTE_TYPES[":default"];
56
+ return [key, typecast(value)];
57
+ }));
58
+ }
59
+ node;
60
+ /** @internal */
61
+ _attributes;
62
+ constructor(node) {
63
+ this.node = node;
64
+ }
65
+ get attributes() {
66
+ return (this._attributes ??= slice({ ...this.attachmentAttributes(), ...this.composedAttributes() }, ...TrixAttachment.ATTRIBUTES));
67
+ }
68
+ toHtml() {
69
+ return HtmlConversion.nodeToHtml(this.node);
70
+ }
71
+ toString() {
72
+ return this.toHtml();
73
+ }
74
+ /** @internal */
75
+ attachmentAttributes() {
76
+ return this.readJsonObjectAttribute("data-trix-attachment");
77
+ }
78
+ /** @internal */
79
+ composedAttributes() {
80
+ return this.readJsonObjectAttribute("data-trix-attributes");
81
+ }
82
+ /** @internal */
83
+ readJsonObjectAttribute(name) {
84
+ const value = this.readJsonAttribute(name);
85
+ return value != null && value !== false ? value : {};
86
+ }
87
+ /** @internal */
88
+ readJsonAttribute(name) {
89
+ const value = this.node.get(name);
90
+ if (value != null) {
91
+ try {
92
+ return JSON.parse(value);
93
+ }
94
+ catch (e) {
95
+ const className = rbModName(this.constructor);
96
+ TopLevel.Trails.logger.error(`[${className}] Couldn't parse JSON ${value} from NODE ${rbInspect(this.node)}`);
97
+ TopLevel.Trails.logger.error(`[${className}] Failed with ${rbModName(e.constructor)}: ${rbInspect(excBacktrace(e))}`);
98
+ return null;
99
+ }
100
+ }
101
+ return null;
102
+ }
103
+ }
104
+ ActionText.TrixAttachment = TrixAttachment;
105
+ //# sourceMappingURL=trix-attachment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trix-attachment.js","sourceRoot":"","sources":["../lib/trix-attachment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE5E,OAAO,EACL,MAAM,EACN,YAAY,EACZ,aAAa,EACb,SAAS,EACT,SAAS,EACT,KAAK,EACL,GAAG,GACJ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAItD,MAAM,OAAO,cAAc;IACzB,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC;IACpC,MAAM,CAAU,QAAQ,GAAG,wBAAwB,CAAC;IAEpD,MAAM,CAAU,mBAAmB,GAAG,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IAClE,MAAM,CAAU,UAAU,GAAG;QAC3B,MAAM;QACN,aAAa;QACb,KAAK;QACL,MAAM;QACN,UAAU;QACV,UAAU;QACV,OAAO;QACP,QAAQ;QACR,aAAa;QACb,SAAS;QACT,GAAG,cAAc,CAAC,mBAAmB;KACtC,CAAC;IACF,MAAM,CAAU,e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AI,SAAS,iBAAiB,SAAS,CAAE,CAAW,CAAC,WAAW,CAAC,KAAK,SAAS,CAAC,YAAY,CAAC,CAAU,CAAC,CAAC,EAAE,CAC5G,CAAC;gBACF,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,UAAU,CAAC,cAAc,GAAG,cAAc,CAAC"}
@@ -0,0 +1,75 @@
1
+ import { Autoload, type Deprecation, type Extended } from "@blazetrails/activesupport";
2
+ import { HTML5 } from "@blazetrails/nokogiri";
3
+ import { type Gem } from "@blazetrails/ruby-compat";
4
+ import type { Attachable } from "./attachable.js";
5
+ import type { ContentAttachment } from "./attachables/content-attachment.js";
6
+ import type { MissingAttachable } from "./attachables/missing-attachable.js";
7
+ import type { RemoteImage } from "./attachables/remote-image.js";
8
+ import type { Attachment } from "./attachment.js";
9
+ import type { Attribute } from "./attribute.js";
10
+ import type { EncryptedRichText } from "./encrypted-rich-text.js";
11
+ import type { Encryption } from "./encryption.js";
12
+ import type { Engine } from "./engine.js";
13
+ import type { FixtureSet } from "./fixture-set.js";
14
+ import type { Record as ActionTextRecord } from "./record.js";
15
+ import type { RichText } from "./rich-text.js";
16
+ import type { Serialization } from "./serialization.js";
17
+ import type { SystemTestHelper } from "./system-test-helper.js";
18
+ import type { AttachmentGallery } from "./attachment-gallery.js";
19
+ import type { Caching } from "./attachments/caching.js";
20
+ import type { Minification } from "./attachments/minification.js";
21
+ import type { TrixConversion } from "./attachments/trix-conversion.js";
22
+ import type { Content } from "./content.js";
23
+ import type { Fragment } from "./fragment.js";
24
+ import type { HtmlConversion } from "./html-conversion.js";
25
+ import type { PlainTextConversion } from "./plain-text-conversion.js";
26
+ import type { ContentHelper } from "./app/helpers/action-text/content-helper.js";
27
+ import type { TagHelper } from "./app/helpers/action-text/tag-helper.js";
28
+ import type { Rendering } from "./rendering.js";
29
+ import type { TrixAttachment } from "./trix-attachment.js";
30
+ type AutoloadModule = Autoload.Autoload & Extended<typeof Autoload>;
31
+ export declare const ActionText: AutoloadModule & {
32
+ deprecator(): Deprecation;
33
+ version(): InstanceType<typeof Gem.Version>;
34
+ gemVersion(): InstanceType<typeof Gem.Version>;
35
+ htmlDocumentClass(): typeof HTML5.Document;
36
+ htmlDocumentFragmentClass(): typeof HTML5.DocumentFragment;
37
+ /** @internal */
38
+ _htmlDocumentClass?: typeof HTML5.Document;
39
+ /** @internal */
40
+ _htmlDocumentFragmentClass?: typeof HTML5.DocumentFragment;
41
+ Attachable?: typeof Attachable;
42
+ Attachables: typeof Attachables;
43
+ Attachment?: typeof Attachment;
44
+ AttachmentGallery?: typeof AttachmentGallery;
45
+ Attachments: typeof Attachments;
46
+ Attribute?: typeof Attribute;
47
+ Content?: typeof Content;
48
+ EncryptedRichText?: typeof EncryptedRichText;
49
+ Encryption?: typeof Encryption;
50
+ Engine?: typeof Engine;
51
+ FixtureSet?: typeof FixtureSet;
52
+ ContentHelper?: typeof ContentHelper;
53
+ Fragment?: typeof Fragment;
54
+ HtmlConversion?: typeof HtmlConversion;
55
+ PlainTextConversion?: typeof PlainTextConversion;
56
+ Record?: typeof ActionTextRecord;
57
+ Rendering?: typeof Rendering;
58
+ RichText?: typeof RichText;
59
+ Serialization?: typeof Serialization;
60
+ SystemTestHelper?: typeof SystemTestHelper;
61
+ TagHelper?: typeof TagHelper;
62
+ TrixAttachment?: typeof TrixAttachment;
63
+ };
64
+ declare const Attachments: AutoloadModule & {
65
+ Caching?: typeof Caching;
66
+ Minification?: typeof Minification;
67
+ TrixConversion?: typeof TrixConversion;
68
+ };
69
+ declare const Attachables: AutoloadModule & {
70
+ ContentAttachment?: typeof ContentAttachment;
71
+ MissingAttachable?: typeof MissingAttachable;
72
+ RemoteImage?: typeof RemoteImage;
73
+ };
74
+ export {};
75
+ //# sourceMappingURL=action-text.d.ts.map
@@ -0,0 +1,35 @@
1
+ import { type SafeBuffer } from "@blazetrails/activesupport";
2
+ import { type Sanitizer } from "@blazetrails/html-sanitizer";
3
+ import { classModule } from "@blazetrails/ruby-compat";
4
+ import { Attachment } from "../../../attachment.js";
5
+ import type { Content } from "../../../content.js";
6
+ type RenderOptions = Record<string, unknown>;
7
+ type ViewHost = ContentHelper & {
8
+ prefixPartialPathWithControllerNamespace: boolean;
9
+ render(options: RenderOptions, locals?: Record<string, unknown>, block?: () => unknown): unknown;
10
+ };
11
+ export declare class ContentHelper {
12
+ /** @noRailsEquivalent PERMANENT */
13
+ static readonly [classModule] = true;
14
+ static sanitizer: Sanitizer;
15
+ static allowedTags: Iterable<string> | null;
16
+ static allowedAttributes: Iterable<string> | null;
17
+ static scrubber: unknown;
18
+ sanitizer: Sanitizer;
19
+ allowedTags: Iterable<string> | null;
20
+ allowedAttributes: Iterable<string> | null;
21
+ scrubber: unknown;
22
+ renderActionTextContent(this: ViewHost, content: Content): Promise<SafeBuffer>;
23
+ sanitizeContentAttachment(contentAttachment: string): string | null | undefined;
24
+ sanitizeActionTextContent(content: Content): SafeBuffer;
25
+ /** @missingRailsArgs join — PERMANENT */
26
+ renderActionTextAttachments(this: ViewHost, content: Content): Promise<Content>;
27
+ /** @internal */
28
+ renderActionTextAttachment(this: ViewHost, attachment: Attachment, { locals }?: {
29
+ locals?: Record<string, unknown>;
30
+ }): Promise<string>;
31
+ sanitizerAllowedTags(): Iterable<string>;
32
+ sanitizerAllowedAttributes(): Iterable<string>;
33
+ }
34
+ export {};
35
+ //# sourceMappingURL=content-helper.d.ts.map