tess_edit 0.5.18 → 0.6.0

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 (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +91 -68
  3. data/app/controllers/tess_edit/compilations_controller.rb +6 -3
  4. data/app/javascript/tess_edit/blocks/assign.js +2 -5
  5. data/app/javascript/tess_edit/blocks/builtin.js +6 -9
  6. data/app/javascript/tess_edit/blocks/button.js +1 -4
  7. data/app/javascript/tess_edit/blocks/column.js +1 -4
  8. data/app/javascript/tess_edit/blocks/condition.js +2 -5
  9. data/app/javascript/tess_edit/blocks/content.js +4 -11
  10. data/app/javascript/tess_edit/blocks/divider.js +1 -4
  11. data/app/javascript/tess_edit/blocks/image.js +1 -4
  12. data/app/javascript/tess_edit/blocks/loop.js +2 -5
  13. data/app/javascript/tess_edit/blocks/raw.js +1 -10
  14. data/app/javascript/tess_edit/blocks/section.js +1 -5
  15. data/app/javascript/tess_edit/blocks/spacer.js +1 -4
  16. data/app/javascript/tess_edit/blocks/table.js +8 -15
  17. data/app/javascript/tess_edit/blocks/text.js +1 -4
  18. data/app/javascript/tess_edit/controllers/editor_controller.js +32 -20
  19. data/app/javascript/tess_edit/core/document.js +8 -8
  20. data/app/javascript/tess_edit/core/media.js +1 -1
  21. data/app/javascript/tess_edit/core/registry.js +29 -25
  22. data/app/javascript/tess_edit/export/compile.js +15 -6
  23. data/app/javascript/tess_edit/export/richtext.js +1 -1
  24. data/app/javascript/tess_edit/export/table.js +9 -7
  25. data/app/javascript/tess_edit/index.js +2 -3
  26. data/app/javascript/tess_edit/ui/canvas.js +5 -5
  27. data/config/locales/en.yml +1 -39
  28. data/config/locales/nl.yml +1 -39
  29. data/lib/tess_edit/content.rb +5 -4
  30. data/lib/tess_edit/version.rb +1 -1
  31. data/lib/tess_edit.rb +34 -8
  32. metadata +1 -24
  33. data/app/javascript/tess_edit/blocks/email.js +0 -83
  34. data/app/javascript/tess_edit/blocks/hero.js +0 -60
  35. data/app/javascript/tess_edit/blocks/navbar.js +0 -49
  36. data/app/javascript/tess_edit/blocks/social.js +0 -39
  37. data/app/javascript/tess_edit/blocks/wrapper.js +0 -24
  38. data/app/javascript/tess_edit/core/starter.js +0 -89
  39. data/app/javascript/tess_edit/export/mjml.js +0 -117
  40. data/app/javascript/tess_edit/kits/builtin.js +0 -5
  41. data/app/javascript/tess_edit/kits/email.js +0 -28
@@ -30,7 +30,6 @@ en:
30
30
  add_right: "Add right"
31
31
  add_row_above: "Add row above"
32
32
  add_row_below: "Add row below"
33
- added_to_the_email_s_style_block: "Added to the email's <style> block."
34
33
  align: "Align"
35
34
  align_center: "Align center"
36
35
  align_left: "Align left"
@@ -47,7 +46,6 @@ en:
47
46
  auto: "Auto"
48
47
  background: "Background"
49
48
  background_image: "Background image"
50
- below_this_width_columns_stack: "Below this width columns stack."
51
49
  between_rows: "Between rows"
52
50
  blank_nothing_or_only_spaces: "Blank: nothing, or only spaces"
53
51
  blocks: "Blocks"
@@ -57,7 +55,6 @@ en:
57
55
  border_color: "Border color"
58
56
  border_width: "Border width"
59
57
  bottom: "Bottom"
60
- breakpoint: "Breakpoint"
61
58
  bulleted_list: "Bulleted list"
62
59
  button: "Button"
63
60
  button_color: "Button color"
@@ -68,7 +65,6 @@ en:
68
65
  cell: "Cell"
69
66
  cell_padding: "Cell padding"
70
67
  center: "Center"
71
- center_center: "center center"
72
68
  choose_an_image: "Choose an image"
73
69
  clear_formatting: "Clear formatting"
74
70
  click_again_to_use_the_default: "Click again to use the default"
@@ -84,16 +80,13 @@ en:
84
80
  contains: "Contains"
85
81
  content: "Content"
86
82
  copied: "Copied."
87
- copied_into_the_email_as_is_liquid_works_here_too: "Copied into the email as-is. Liquid works here too."
83
+ copied_into_the_document_as_it_is_liquid_works_here_too: "Copied into the document as it is. Liquid works here too."
88
84
  copy: "Copy"
89
- css: "CSS"
90
- custom_css: "Custom CSS"
91
85
  dashed: "Dashed"
92
86
  default: "Default"
93
87
  delete: "Delete"
94
88
  delete_column: "Delete column"
95
89
  delete_row: "Delete row"
96
- desktop: "Desktop"
97
90
  divider: "Divider"
98
91
  doesn_t_equal: "Doesn't equal"
99
92
  done: "Done"
@@ -106,9 +99,7 @@ en:
106
99
  drag_to_resize: "Drag to resize"
107
100
  drag_to_set_the_column_s_width: "Drag to set the column's width"
108
101
  drop_a_cell_here: "Drop a cell here"
109
- drop_a_column_here: "Drop a column here"
110
102
  drop_a_row_here: "Drop a row here"
111
- drop_a_section_here: "Drop a section here"
112
103
  drop_content_here: "Drop content here"
113
104
  duplicate: "Duplicate"
114
105
  each_of_collection: "Each of %{collection}"
@@ -117,7 +108,6 @@ en:
117
108
  edit_link: "Edit link"
118
109
  edit_the_locale_text: "Edit the %{locale} text"
119
110
  editing_text_key_to_finish: "Editing text · %{key} to finish"
120
- email: "Email"
121
111
  empty: "(empty)"
122
112
  empty_for_now_fill_it_in_where_it_comes_from: "Empty for now: fill it in where it comes from"
123
113
  empty_no_items_or_text: "Empty: no items or text"
@@ -126,32 +116,22 @@ en:
126
116
  every_other_row: "Every other row"
127
117
  expand: "Expand"
128
118
  find_in_source: "Find in %{source}"
129
- fixed_height: "Fixed height"
130
- fluid: "Fluid"
131
119
  font_family: "Font family"
132
120
  font_size: "Font size"
133
121
  font_weight: "Font weight"
134
122
  fonts: "Fonts"
135
123
  full: "Full"
136
- full_width: "Full width"
137
124
  goes_on_with_the_next_item: "Goes on with the next item"
138
- hamburger_on_mobile: "Hamburger on mobile"
139
125
  has_no: "%{path} has no %{name}"
140
126
  heading: "Heading"
141
127
  heading_level: "Heading %{level}"
142
128
  heading_row: "Heading row"
143
129
  heading_rows: "Heading rows"
144
130
  height: "Height"
145
- hero: "Hero"
146
131
  hide_panels: "Hide panels"
147
- horizontal: "Horizontal"
148
132
  how_many_columns_the_cell_takes_merging_it_with_the_cells_to: "How many columns the cell takes, merging it with the cells to its right."
149
133
  html: "HTML"
150
- icon_padding: "Icon padding"
151
- icon_size: "Icon size"
152
134
  image: "Image"
153
- image_height: "Image height"
154
- image_width: "Image width"
155
135
  in_px_or_e_g_50: "In px or %, e.g. 50%."
156
136
  in_the_heading_rows_style_heading_rows_at_the_top_repeat_on: "In the heading rows' style. Heading rows at the top repeat on every page."
157
137
  inherit: "Inherit"
@@ -182,11 +162,8 @@ en:
182
162
  lines: "Lines"
183
163
  lines_around_every_cell_or_only_under_each_row: "Lines around every cell, or only under each row."
184
164
  link: "Link"
185
- links: "Links"
186
165
  liquid: "Liquid"
187
166
  liquid_is_allowed_e_g_order_url: "Liquid is allowed, e.g. {{ order.url }}"
188
- liquid_is_left_in_place_for_rendering_at_send_time: "Liquid is left in place for rendering at send time."
189
- liquid_loops_and_conditions_are_in_mj_raw_tags: "Liquid loops and conditions are in <mj-raw> tags."
190
167
  liquid_tags_can_t_go_into_a_translation_select_the_text_arou: "Liquid tags ({% … %}) can't go into a translation. Select the text around them."
191
168
  load_this_json: "Load this JSON"
192
169
  loading: "Loading…"
@@ -198,21 +175,16 @@ en:
198
175
  make_translatable: "Make translatable"
199
176
  make_translatable_keep_the_selected_text_as_a_translation: "Make translatable: keep the selected text as a translation"
200
177
  make_translatable_keep_the_selected_text_or_all_of_it_as_a_t: "Make translatable: keep the selected text, or all of it, as a translation"
201
- message: "Message"
202
178
  middle: "Middle"
203
179
  missing: "missing"
204
- mobile: "Mobile"
205
- mode: "Mode"
206
180
  more_than: "More than"
207
181
  move_up: "Move up"
208
182
  name_can_t_go_here_its_type_blocks_don_t_fit: "%{name} can't go here: its %{type} blocks don't fit."
209
183
  name_canvas: "%{name} canvas"
210
184
  name_doesn_t_fit_anywhere_yet_add_a_block_it_goes_in_first_o: "%{name} doesn't fit anywhere yet. Add a block it goes in first, or drag it onto the canvas."
211
185
  name_doesn_t_fit_here_select_where_it_goes_first_or_drag_it: "%{name} doesn't fit here. Select where it goes first, or drag it onto the canvas."
212
- navbar: "Navbar"
213
186
  needs_1_argument: "%{filter} needs 1 argument"
214
187
  needs_arguments_not: "%{filter} needs %{count} arguments, not %{given}"
215
- network: "Network"
216
188
  new_tab: "New tab"
217
189
  no_argument_for_names_in_the_t_filter: "No argument for %{names} in the t filter"
218
190
  no_fonts_with_that_name: "No fonts with that name"
@@ -234,10 +206,7 @@ en:
234
206
  paragraph: "Paragraph"
235
207
  paragraph_style: "Paragraph style"
236
208
  part_of_the_layout: "Part of the layout"
237
- position: "Position"
238
209
  preview: "Preview"
239
- preview_text: "Preview text"
240
- preview_the_email_as_sent_with_liquid_tags: "Preview the email as sent, with Liquid tags"
241
210
  radius: "Radius"
242
211
  redo_z: "Redo (⇧⌘Z)"
243
212
  remove: "Remove"
@@ -262,16 +231,13 @@ en:
262
231
  show_the_row_in_a_condition: "Show the row in a Condition"
263
232
  show_translations_in: "Show translations in"
264
233
  show_when: "Show when"
265
- shown_after_the_subject_in_most_inboxes: "Shown after the subject in most inboxes."
266
234
  shows_its_blocks_only_when_the_condition_is_true_if_expressi: "Shows its blocks only when the condition is true: {% if expression %}."
267
- social: "Social"
268
235
  solid: "Solid"
269
236
  spacer: "Spacer"
270
237
  spans_columns: "Spans columns"
271
238
  stops_the_loop: "Stops the loop"
272
239
  strikethrough: "Strikethrough"
273
240
  style: "Style"
274
- subject: "Subject"
275
241
  table: "Table"
276
242
  takes_1_argument_not: "%{filter} takes 1 argument, not %{given}"
277
243
  takes_arguments_not: "%{filter} takes %{count} arguments, not %{given}"
@@ -280,12 +246,10 @@ en:
280
246
  the_content_of_the_documents_using_this_layout_goes_here_wha: "The content of the documents using this layout goes here. What you put inside is example content for designing the layout."
281
247
  the_document_edit_and_load_it_or_paste_one_in: "The document. Edit and load it, or paste one in."
282
248
  the_document_parts_of_it_are_locked_so_it_can_t_be_loaded_he: "The document. Parts of it are locked, so it can't be loaded here."
283
- the_email_could_not_be_compiled: "The email could not be compiled"
284
249
  the_name_could_not_be_rendered: "The %{name} could not be rendered"
285
250
  the_name_each_item_gets_e_g_line: "The name each item gets, e.g. line."
286
251
  the_name_the_blocks_after_it_use_e_g_lines: "The name the blocks after it use, e.g. lines."
287
252
  the_upload: "The upload"
288
- theme: "Theme"
289
253
  there_are_no_languages_to_translate_into_yet: "There are no languages to translate into yet."
290
254
  there_is_a_name_already_a_document_has_one: "There is a %{name} already; a document has one."
291
255
  there_s_no_filter: "There's no filter %{filter}"
@@ -309,7 +273,6 @@ en:
309
273
  value: "Value"
310
274
  variable: "Variable"
311
275
  variables: "Variables"
312
- vertical: "Vertical"
313
276
  vertical_align: "Vertical align"
314
277
  web: "Web"
315
278
  what_to_loop_over_e_g_invoice_lines: "What to loop over, e.g. invoice.lines."
@@ -319,4 +282,3 @@ en:
319
282
  whether_it_s_the_last: "Whether it's the last"
320
283
  width: "Width"
321
284
  without: "{% %{tag} %} without {% %{block} %}"
322
- wrapper: "Wrapper"
@@ -30,7 +30,6 @@ nl:
30
30
  add_right: "Rechts toevoegen"
31
31
  add_row_above: "Rij erboven toevoegen"
32
32
  add_row_below: "Rij eronder toevoegen"
33
- added_to_the_email_s_style_block: "Wordt toegevoegd aan het <style>-blok van de e-mail."
34
33
  align: "Uitlijning"
35
34
  align_center: "Centreren"
36
35
  align_left: "Links uitlijnen"
@@ -47,7 +46,6 @@ nl:
47
46
  auto: "Automatisch"
48
47
  background: "Achtergrond"
49
48
  background_image: "Achtergrondafbeelding"
50
- below_this_width_columns_stack: "Onder deze breedte komen kolommen onder elkaar."
51
49
  between_rows: "Tussen rijen"
52
50
  blank_nothing_or_only_spaces: "Leeg: niets, of alleen spaties"
53
51
  blocks: "Blokken"
@@ -57,7 +55,6 @@ nl:
57
55
  border_color: "Randkleur"
58
56
  border_width: "Randdikte"
59
57
  bottom: "Onder"
60
- breakpoint: "Breekpunt"
61
58
  bulleted_list: "Opsomming"
62
59
  button: "Knop"
63
60
  button_color: "Knopkleur"
@@ -68,7 +65,6 @@ nl:
68
65
  cell: "Cel"
69
66
  cell_padding: "Celmarge"
70
67
  center: "Midden"
71
- center_center: "center center"
72
68
  choose_an_image: "Kies een afbeelding"
73
69
  clear_formatting: "Opmaak wissen"
74
70
  click_again_to_use_the_default: "Klik nogmaals voor de standaardwaarde"
@@ -84,16 +80,13 @@ nl:
84
80
  contains: "Bevat"
85
81
  content: "Inhoud"
86
82
  copied: "Gekopieerd."
87
- copied_into_the_email_as_is_liquid_works_here_too: "Wordt ongewijzigd in de e-mail gezet. Liquid werkt hier ook."
83
+ copied_into_the_document_as_it_is_liquid_works_here_too: "Wordt ongewijzigd in het document gezet. Liquid werkt hier ook."
88
84
  copy: "Kopiëren"
89
- css: "CSS"
90
- custom_css: "Eigen CSS"
91
85
  dashed: "Gestreept"
92
86
  default: "Standaard"
93
87
  delete: "Verwijderen"
94
88
  delete_column: "Kolom verwijderen"
95
89
  delete_row: "Rij verwijderen"
96
- desktop: "Desktop"
97
90
  divider: "Scheidingslijn"
98
91
  doesn_t_equal: "Is niet gelijk aan"
99
92
  done: "Klaar"
@@ -106,9 +99,7 @@ nl:
106
99
  drag_to_resize: "Sleep om het formaat te wijzigen"
107
100
  drag_to_set_the_column_s_width: "Sleep om de kolombreedte in te stellen"
108
101
  drop_a_cell_here: "Zet hier een cel neer"
109
- drop_a_column_here: "Zet hier een kolom neer"
110
102
  drop_a_row_here: "Zet hier een rij neer"
111
- drop_a_section_here: "Zet hier een sectie neer"
112
103
  drop_content_here: "Zet hier inhoud neer"
113
104
  duplicate: "Dupliceren"
114
105
  each_of_collection: "Elk item van %{collection}"
@@ -117,7 +108,6 @@ nl:
117
108
  edit_link: "Link bewerken"
118
109
  edit_the_locale_text: "De %{locale}-tekst bewerken"
119
110
  editing_text_key_to_finish: "Tekst bewerken · %{key} om af te ronden"
120
- email: "E-mail"
121
111
  empty: "(leeg)"
122
112
  empty_for_now_fill_it_in_where_it_comes_from: "Nog leeg: vul het in waar het vandaan komt"
123
113
  empty_no_items_or_text: "Leeg: geen items of tekst"
@@ -126,32 +116,22 @@ nl:
126
116
  every_other_row: "Om de andere rij"
127
117
  expand: "Vergroten"
128
118
  find_in_source: "Zoeken in %{source}"
129
- fixed_height: "Vaste hoogte"
130
- fluid: "Meeschalend"
131
119
  font_family: "Lettertype"
132
120
  font_size: "Lettergrootte"
133
121
  font_weight: "Letterdikte"
134
122
  fonts: "Lettertypen"
135
123
  full: "Volledig"
136
- full_width: "Volle breedte"
137
124
  goes_on_with_the_next_item: "Gaat door met het volgende item"
138
- hamburger_on_mobile: "Hamburgermenu op mobiel"
139
125
  has_no: "%{path} heeft geen %{name}"
140
126
  heading: "Kop"
141
127
  heading_level: "Kop %{level}"
142
128
  heading_row: "Kopregel"
143
129
  heading_rows: "Kopregels"
144
130
  height: "Hoogte"
145
- hero: "Banner"
146
131
  hide_panels: "Panelen verbergen"
147
- horizontal: "Horizontaal"
148
132
  how_many_columns_the_cell_takes_merging_it_with_the_cells_to: "Hoeveel kolommen de cel beslaat, samengevoegd met de cellen rechts ervan."
149
133
  html: "HTML"
150
- icon_padding: "Ruimte rond pictogram"
151
- icon_size: "Pictogramgrootte"
152
134
  image: "Afbeelding"
153
- image_height: "Afbeeldingshoogte"
154
- image_width: "Afbeeldingsbreedte"
155
135
  in_px_or_e_g_50: "In px of %, bijv. 50%."
156
136
  in_the_heading_rows_style_heading_rows_at_the_top_repeat_on: "In de stijl van de kopregels. Kopregels bovenaan herhalen op elke pagina."
157
137
  inherit: "Overnemen"
@@ -182,11 +162,8 @@ nl:
182
162
  lines: "Lijnen"
183
163
  lines_around_every_cell_or_only_under_each_row: "Lijnen om elke cel, of alleen onder elke rij."
184
164
  link: "Link"
185
- links: "Links"
186
165
  liquid: "Liquid"
187
166
  liquid_is_allowed_e_g_order_url: "Liquid mag, bijv. {{ order.url }}"
188
- liquid_is_left_in_place_for_rendering_at_send_time: "Liquid blijft staan en wordt bij het versturen ingevuld."
189
- liquid_loops_and_conditions_are_in_mj_raw_tags: "Liquid-herhalingen en -voorwaarden staan in <mj-raw>-tags."
190
167
  liquid_tags_can_t_go_into_a_translation_select_the_text_arou: "Liquid-tags ({% … %}) kunnen niet in een vertaling. Selecteer de tekst eromheen."
191
168
  load_this_json: "Deze JSON laden"
192
169
  loading: "Laden…"
@@ -198,21 +175,16 @@ nl:
198
175
  make_translatable: "Vertaalbaar maken"
199
176
  make_translatable_keep_the_selected_text_as_a_translation: "Vertaalbaar maken: de geselecteerde tekst als vertaling bewaren"
200
177
  make_translatable_keep_the_selected_text_or_all_of_it_as_a_t: "Vertaalbaar maken: de geselecteerde tekst, of alles, als vertaling bewaren"
201
- message: "Bericht"
202
178
  middle: "Midden"
203
179
  missing: "ontbreekt"
204
- mobile: "Mobiel"
205
- mode: "Modus"
206
180
  more_than: "Meer dan"
207
181
  move_up: "Omhoog"
208
182
  name_can_t_go_here_its_type_blocks_don_t_fit: "%{name} kan hier niet: de blokken %{type} passen er niet in."
209
183
  name_canvas: "%{name}-canvas"
210
184
  name_doesn_t_fit_anywhere_yet_add_a_block_it_goes_in_first_o: "%{name} past nog nergens. Voeg eerst een blok toe waar het in kan, of sleep het naar het canvas."
211
185
  name_doesn_t_fit_here_select_where_it_goes_first_or_drag_it: "%{name} past hier niet. Selecteer eerst waar het moet komen, of sleep het naar het canvas."
212
- navbar: "Navigatiebalk"
213
186
  needs_1_argument: "%{filter} heeft 1 argument nodig"
214
187
  needs_arguments_not: "%{filter} heeft %{count} argumenten nodig, niet %{given}"
215
- network: "Netwerk"
216
188
  new_tab: "Nieuw tabblad"
217
189
  no_argument_for_names_in_the_t_filter: "Geen argument voor %{names} in het t-filter"
218
190
  no_fonts_with_that_name: "Geen lettertypen met die naam"
@@ -234,10 +206,7 @@ nl:
234
206
  paragraph: "Alinea"
235
207
  paragraph_style: "Alineastijl"
236
208
  part_of_the_layout: "Onderdeel van de layout"
237
- position: "Positie"
238
209
  preview: "Voorbeeld"
239
- preview_text: "Voorbeeldtekst"
240
- preview_the_email_as_sent_with_liquid_tags: "Voorbeeld van de e-mail zoals die wordt verstuurd, met Liquid-tags"
241
210
  radius: "Afronding"
242
211
  redo_z: "Opnieuw (⇧⌘Z)"
243
212
  remove: "Verwijderen"
@@ -262,16 +231,13 @@ nl:
262
231
  show_the_row_in_a_condition: "Rij tonen in een Condition"
263
232
  show_translations_in: "Vertalingen tonen in"
264
233
  show_when: "Tonen als"
265
- shown_after_the_subject_in_most_inboxes: "In de meeste inboxen getoond na het onderwerp."
266
234
  shows_its_blocks_only_when_the_condition_is_true_if_expressi: "Toont zijn blokken alleen als de voorwaarde waar is: {% if expression %}."
267
- social: "Sociale media"
268
235
  solid: "Doorgetrokken"
269
236
  spacer: "Witruimte"
270
237
  spans_columns: "Beslaat kolommen"
271
238
  stops_the_loop: "Stopt de lus"
272
239
  strikethrough: "Doorhalen"
273
240
  style: "Stijl"
274
- subject: "Onderwerp"
275
241
  table: "Tabel"
276
242
  takes_1_argument_not: "%{filter} neemt 1 argument, niet %{given}"
277
243
  takes_arguments_not: "%{filter} neemt %{count} argumenten, niet %{given}"
@@ -280,12 +246,10 @@ nl:
280
246
  the_content_of_the_documents_using_this_layout_goes_here_wha: "Hier komt de inhoud van wat deze layout gebruikt. Wat je erin zet, is voorbeeldinhoud om de layout te ontwerpen."
281
247
  the_document_edit_and_load_it_or_paste_one_in: "Het document. Bewerk en laad het, of plak er een in."
282
248
  the_document_parts_of_it_are_locked_so_it_can_t_be_loaded_he: "Het document. Delen ervan zijn vergrendeld, dus het kan hier niet worden geladen."
283
- the_email_could_not_be_compiled: "De e-mail kon niet worden gemaakt"
284
249
  the_name_could_not_be_rendered: "%{name} kon niet worden weergegeven"
285
250
  the_name_each_item_gets_e_g_line: "De naam die elk item krijgt, bijv. line."
286
251
  the_name_the_blocks_after_it_use_e_g_lines: "De naam die de blokken erna gebruiken, bijv. lines."
287
252
  the_upload: "Het uploaden"
288
- theme: "Thema"
289
253
  there_are_no_languages_to_translate_into_yet: "Er zijn nog geen talen om naar te vertalen."
290
254
  there_is_a_name_already_a_document_has_one: "Er is al een %{name}; een document heeft er één."
291
255
  there_s_no_filter: "Er is geen filter %{filter}"
@@ -309,7 +273,6 @@ nl:
309
273
  value: "Waarde"
310
274
  variable: "Variabele"
311
275
  variables: "Variabelen"
312
- vertical: "Verticaal"
313
276
  vertical_align: "Verticale uitlijning"
314
277
  web: "Web"
315
278
  what_to_loop_over_e_g_invoice_lines: "Waarover te herhalen, bijv. invoice.lines."
@@ -319,4 +282,3 @@ nl:
319
282
  whether_it_s_the_last: "Of het de laatste is"
320
283
  width: "Breedte"
321
284
  without: "{% %{tag} %} zonder {% %{block} %}"
322
- wrapper: "Kader"
@@ -1,6 +1,7 @@
1
1
  module TessEdit
2
2
  # A document's own content in its layout. The layout's Content block marks
3
- # its place in the MJML or HTML with two comments (in <mj-raw> tags in MJML):
3
+ # its place in the output with two comments, which a kit may put in a tag
4
+ # of its own, such as MJML's <mj-raw>:
4
5
  #
5
6
  # <!-- tess-edit:content --> … the blocks inside the Content block … <!-- /tess-edit:content -->
6
7
  #
@@ -11,9 +12,9 @@ module TessEdit
11
12
  module Content
12
13
  START = "<!-- tess-edit:content -->"
13
14
  FINISH = "<!-- /tess-edit:content -->"
14
- MJML_START = "<mj-raw>#{START}</mj-raw>"
15
- MJML_FINISH = "<mj-raw>#{FINISH}</mj-raw>"
16
- MARKED = /(#{Regexp.escape(MJML_START)}|#{Regexp.escape(START)})(.*?)(#{Regexp.escape(MJML_FINISH)}|#{Regexp.escape(FINISH)})/m
15
+ # A marker, in a tag of its own or not
16
+ MARKER = ->(comment) { /(?:<[\w-]+>)?#{Regexp.escape(comment)}(?:<\/[\w-]+>)?/ }
17
+ MARKED = /(#{MARKER.call(START)})(.*?)(#{MARKER.call(FINISH)})/m
17
18
 
18
19
  class Error < StandardError; end
19
20
 
@@ -1,3 +1,3 @@
1
1
  module TessEdit
2
- VERSION = "0.5.18"
2
+ VERSION = "0.6.0"
3
3
  end
data/lib/tess_edit.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require "importmap-rails"
2
2
  require "stimulus-rails"
3
- require "mrml"
4
3
  require "tess_edit/version"
5
4
  require "tess_edit/engine"
6
5
  require "tess_edit/content"
@@ -8,6 +7,8 @@ require "tess_edit/content"
8
7
  module TessEdit
9
8
  Result = Data.define(:html, :errors)
10
9
 
10
+ class UnknownCompiler < StandardError; end
11
+
11
12
  # The controller the engine's controllers inherit from, as a string. Set it
12
13
  # to a controller of the host app, such as "Admin::BaseController", so the
13
14
  # compile endpoint is behind the same sign-in and authorization:
@@ -16,14 +17,39 @@ module TessEdit
16
17
  # TessEdit.parent_controller = "Admin::BaseController"
17
18
  mattr_accessor :parent_controller, default: "ActionController::Base"
18
19
 
19
- # Compiles MJML to HTML with MRML. Liquid passes through untouched. When the
20
- # MJML can't be parsed, html is nil and errors holds the reason.
20
+ mattr_accessor :compilers, default: {}
21
+
22
+ # A compiler for a kit whose output is made on the server, such as an
23
+ # email's MJML that becomes HTML. The block takes the source and returns
24
+ # the HTML, or a TessEdit::Result with the reasons it couldn't; an error
25
+ # it raises is one of those reasons too:
21
26
  #
22
- # Browsers submit form fields with CRLF line endings, which MRML can't parse
23
- # in mj-head, so line endings become LF first.
24
- def self.compile(mjml)
25
- Result.new(html: MRML::Template.new(mjml.to_s.gsub(/\r\n?/, "\n")).to_html, errors: [])
26
- rescue MRML::Error => error
27
+ # TessEdit.register_compiler(:mjml) { |mjml| MRML::Template.new(mjml).to_html }
28
+ #
29
+ # The kit compiles through the engine's endpoint, POST /tess_edit/compile
30
+ # with {compiler: "mjml", source: "…"} (compile in
31
+ # app/javascript/tess_edit/export/compile.js), and the host
32
+ # with TessEdit.compile(:mjml, source), so both make the same HTML.
33
+ def self.register_compiler(name, &compiler)
34
+ raise ArgumentError, "A compiler needs a block" unless compiler
35
+
36
+ compilers[name.to_s] = compiler
37
+ end
38
+
39
+ def self.compiler?(name)
40
+ compilers.key?(name.to_s)
41
+ end
42
+
43
+ # The source compiled by the named compiler: html, nil when it couldn't
44
+ # be compiled, and errors, the reasons. Browsers submit form fields with
45
+ # CRLF line endings, so line endings become LF first.
46
+ def self.compile(name, source)
47
+ compiler = compilers.fetch(name.to_s) { raise UnknownCompiler, "No compiler #{name}, see TessEdit.register_compiler" }
48
+ result = compiler.call(source.to_s.gsub(/\r\n?/, "\n"))
49
+ result.is_a?(Result) ? result : Result.new(html: result.to_s, errors: [])
50
+ rescue UnknownCompiler
51
+ raise
52
+ rescue => error
27
53
  Result.new(html: nil, errors: [error.message])
28
54
  end
29
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tess_edit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.18
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom de Grunt
@@ -51,20 +51,6 @@ dependencies:
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
- - !ruby/object:Gem::Dependency
55
- name: mrml
56
- requirement: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: '1.10'
61
- type: :runtime
62
- prerelease: false
63
- version_requirements: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: '1.10'
68
54
  description: A drag-and-drop block editor that stores a JSON tree and exports MJML
69
55
  and HTML, with Liquid support. Vanilla JavaScript and Stimulus, served through importmap.
70
56
  email:
@@ -88,19 +74,14 @@ files:
88
74
  - app/javascript/tess_edit/blocks/condition.js
89
75
  - app/javascript/tess_edit/blocks/content.js
90
76
  - app/javascript/tess_edit/blocks/divider.js
91
- - app/javascript/tess_edit/blocks/email.js
92
77
  - app/javascript/tess_edit/blocks/fields.js
93
- - app/javascript/tess_edit/blocks/hero.js
94
78
  - app/javascript/tess_edit/blocks/image.js
95
79
  - app/javascript/tess_edit/blocks/loop.js
96
- - app/javascript/tess_edit/blocks/navbar.js
97
80
  - app/javascript/tess_edit/blocks/raw.js
98
81
  - app/javascript/tess_edit/blocks/section.js
99
- - app/javascript/tess_edit/blocks/social.js
100
82
  - app/javascript/tess_edit/blocks/spacer.js
101
83
  - app/javascript/tess_edit/blocks/table.js
102
84
  - app/javascript/tess_edit/blocks/text.js
103
- - app/javascript/tess_edit/blocks/wrapper.js
104
85
  - app/javascript/tess_edit/controllers/editor_controller.js
105
86
  - app/javascript/tess_edit/core/document.js
106
87
  - app/javascript/tess_edit/core/history.js
@@ -110,18 +91,14 @@ files:
110
91
  - app/javascript/tess_edit/core/lock.js
111
92
  - app/javascript/tess_edit/core/media.js
112
93
  - app/javascript/tess_edit/core/registry.js
113
- - app/javascript/tess_edit/core/starter.js
114
94
  - app/javascript/tess_edit/core/table.js
115
95
  - app/javascript/tess_edit/core/translations.js
116
96
  - app/javascript/tess_edit/core/values.js
117
97
  - app/javascript/tess_edit/core/variables.js
118
98
  - app/javascript/tess_edit/export/compile.js
119
- - app/javascript/tess_edit/export/mjml.js
120
99
  - app/javascript/tess_edit/export/richtext.js
121
100
  - app/javascript/tess_edit/export/table.js
122
101
  - app/javascript/tess_edit/index.js
123
- - app/javascript/tess_edit/kits/builtin.js
124
- - app/javascript/tess_edit/kits/email.js
125
102
  - app/javascript/tess_edit/ui/blocks_panel.js
126
103
  - app/javascript/tess_edit/ui/canvas.js
127
104
  - app/javascript/tess_edit/ui/code_input.js
@@ -1,83 +0,0 @@
1
- // The root of an email: renders the whole <mjml> document, with the
2
- // email's subject, preview text and theme in <mj-head>.
3
-
4
- export default {
5
- type: "email",
6
- name: "Email",
7
- icon: "root",
8
- roles: [],
9
- accepts: ["body", "wrapper"],
10
- defaults: () => ({
11
- attributes: { width: "600px", "background-color": "#f3f4f6" },
12
- data: {
13
- subject: "",
14
- preheader: "",
15
- breakpoint: "480px",
16
- fontFamily: "Helvetica, Arial, sans-serif",
17
- fontSize: "14px",
18
- lineHeight: "1.6",
19
- textColor: "#111827",
20
- css: ""
21
- }
22
- }),
23
- fields: [
24
- {
25
- title: "Message",
26
- fields: [
27
- { key: "data.subject", label: "Subject", type: "text", liquid: true },
28
- { key: "data.preheader", label: "Preview text", type: "text", liquid: true, hint: "Shown after the subject in most inboxes." }
29
- ]
30
- },
31
- {
32
- title: "Layout",
33
- fields: [
34
- { key: "attributes.width", label: "Width", type: "size", placeholder: "600px" },
35
- { key: "data.breakpoint", label: "Breakpoint", type: "size", placeholder: "480px", hint: "Below this width columns stack." },
36
- { key: "attributes.background-color", label: "Background", type: "color" }
37
- ]
38
- },
39
- {
40
- title: "Theme",
41
- fields: [
42
- { key: "data.fontFamily", label: "Font family", type: "font" },
43
- { key: "data.fontSize", label: "Font size", type: "size" },
44
- { key: "data.lineHeight", label: "Line height", type: "text" },
45
- { key: "data.textColor", label: "Text color", type: "color" }
46
- ]
47
- },
48
- {
49
- title: "Custom CSS",
50
- collapsed: true,
51
- fields: [{ key: "data.css", label: "CSS", type: "code", language: "css", hint: "Added to the email's <style> block." }]
52
- }
53
- ],
54
- render: {
55
- mjml(node, { attrs, cssClass, children, indent, escapeText, escapeAttribute }) {
56
- const d = node.data || {}
57
- const head = []
58
- if (d.subject) head.push(`<mj-title>${escapeText(d.subject)}</mj-title>`)
59
- if (d.preheader) head.push(`<mj-preview>${escapeText(d.preheader)}</mj-preview>`)
60
- if (d.breakpoint) head.push(`<mj-breakpoint width="${escapeAttribute(d.breakpoint)}" />`)
61
- head.push(
62
- [
63
- "<mj-attributes>",
64
- ` <mj-all${attrs({ "font-family": d.fontFamily })} />`,
65
- ` <mj-text${attrs({ "font-size": d.fontSize, "line-height": d.lineHeight, color: d.textColor })} />`,
66
- "</mj-attributes>"
67
- ].join("\n")
68
- )
69
- if (d.css) head.push(`<mj-style>\n${d.css}\n</mj-style>`)
70
-
71
- return [
72
- "<mjml>",
73
- " <mj-head>",
74
- indent(head.join("\n"), 2),
75
- " </mj-head>",
76
- ` <mj-body${attrs(node.attributes, cssClass(node))}>`,
77
- indent(children(node, "body").join("\n"), 2),
78
- " </mj-body>",
79
- "</mjml>"
80
- ].join("\n")
81
- }
82
- }
83
- }