lexxy 0.1.23.beta → 0.1.25.beta

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.
Binary file
Binary file
@@ -195,6 +195,42 @@
195
195
  .token.punctuation {
196
196
  color: var(--lexxy-color-code-token-punctuation);
197
197
  }
198
+
199
+ /* Tables */
200
+ :where(.lexxy-content__table-wrapper) {
201
+ margin-block: 1ch;
202
+ overflow-x: auto;
203
+ }
204
+
205
+ table {
206
+ border-collapse: collapse;
207
+ border-spacing: 0;
208
+ inline-size: calc(100% - 0.5ch);
209
+ margin: 0.25ch;
210
+
211
+ th,
212
+ td {
213
+ border: 1px solid var(--lexxy-color-ink-lighter);
214
+ padding: 1ch;
215
+ text-align: start;
216
+ word-break: normal;
217
+
218
+ *:last-child {
219
+ margin-block-end: 0;
220
+ }
221
+
222
+ &.lexxy-content__table-cell--header {
223
+ background-color: var(--lexxy-color-ink-lightest);
224
+ font-weight: bold;
225
+ }
226
+
227
+ *:is(code, pre) {
228
+ hyphens: auto;
229
+ text-wrap: wrap;
230
+ white-space: pre-wrap;
231
+ }
232
+ }
233
+ }
198
234
  }
199
235
 
200
236
  :where([data-lexical-cursor]) {
@@ -36,6 +36,7 @@
36
36
  cursor: pointer;
37
37
  font-size: inherit;
38
38
  inline-size: auto;
39
+ padding: 0;
39
40
 
40
41
  @media(any-hover: hover) {
41
42
  &:hover:not([aria-disabled="true"]) {
@@ -52,6 +53,23 @@
52
53
  }
53
54
  }
54
55
 
56
+ table {
57
+ .table-cell--selected {
58
+ background-color: var(--lexxy-color-table-cell-selected-bg) !important;
59
+ }
60
+
61
+ .lexxy-content__table-cell--selected {
62
+ background-color: var(--lexxy-color-table-cell-selected-bg) !important;
63
+ border-color: var(--lexxy-color-table-cell-selected-border) !important;
64
+ }
65
+
66
+ &.lexxy-content__table--selection {
67
+ ::selection {
68
+ background: transparent;
69
+ }
70
+ }
71
+ }
72
+
55
73
  action-text-attachment {
56
74
  cursor: pointer;
57
75
  }
@@ -189,7 +207,7 @@
189
207
  user-select: none;
190
208
  -webkit-user-select: none;
191
209
 
192
- .lexxy-editor__toolbar-dropdown-content {
210
+ :where(.lexxy-editor__toolbar-dropdown-content) {
193
211
  --dropdown-padding: 1ch;
194
212
  --dropdown-gap: calc(var(--dropdown-padding) / 2);
195
213
 
@@ -358,6 +376,212 @@
358
376
  }
359
377
  }
360
378
 
379
+ /* Table dropdown
380
+ /* -------------------------------------------------------------------------- */
381
+
382
+ :where(lexxy-table-dropdown) {
383
+ display: flex;
384
+ flex-direction: column;
385
+ gap: 1ch;
386
+
387
+ .lexxy-editor__table-create {
388
+ display: flex;
389
+ flex-direction: column;
390
+ flex-wrap: wrap;
391
+ gap: 0;
392
+
393
+ .lexxy-editor__table-buttons {
394
+ background-color: var(--lexxy-color-ink-lighter);
395
+ display: flex;
396
+ flex-direction: column;
397
+ gap: 1px;
398
+ padding: 1px;
399
+
400
+ div {
401
+ display: flex;
402
+ flex-direction: row;
403
+ gap: 1px;
404
+ }
405
+
406
+ button {
407
+ aspect-ratio: 1.5 / 1;
408
+ border: 0;
409
+ border-radius: 0;
410
+ color: var(--lexxy-color-ink);
411
+ font-family: var(--lexxy-font-base);
412
+ font-size: var(--lexxy-text-small);
413
+ font-weight: normal;
414
+ inline-size: 4ch;
415
+ margin: 0;
416
+
417
+ &.active {
418
+ background-color: var(--lexxy-color-ink-lightest);
419
+ }
420
+ }
421
+ }
422
+
423
+ label {
424
+ align-items: center;
425
+ display: flex;
426
+ gap: 0.5ch;
427
+ padding: 0.5ch 0;
428
+ margin-block-start: 1ch;
429
+ }
430
+
431
+ &:has(input[type="checkbox"]:checked) {
432
+ .lexxy-editor__table-buttons {
433
+ div:first-child button,
434
+ button:first-child {
435
+ filter: brightness(0.95);
436
+ }
437
+ }
438
+ }
439
+ }
440
+
441
+ .lexxy-editor__table-edit {
442
+ display: flex;
443
+ flex-direction: column;
444
+ flex-wrap: wrap;
445
+ gap: 0;
446
+
447
+ button {
448
+
449
+ }
450
+ }
451
+ }
452
+
453
+ /* Table handle buttons
454
+ /* -------------------------------------------------------------------------- */
455
+
456
+ :where(.lexxy-table-handle-buttons) {
457
+ --button-size: 2.5lh;
458
+ color: var(--lexxy-color-ink-inverted);
459
+ display: none;
460
+ flex-direction: row;
461
+ font-size: var(--lexxy-text-small);
462
+ gap: 0.25ch;
463
+ line-height: 1;
464
+ position: absolute;
465
+ transform: translate(-50%, -120%);
466
+ z-index: 10;
467
+
468
+ .lexxy-table-control {
469
+ align-items: center;
470
+ background-color: var(--lexxy-color-ink);
471
+ border-radius: 0.75ch;
472
+ display: flex;
473
+ flex-direction: row;
474
+ gap: 1ch;
475
+ padding: 2px;
476
+ white-space: nowrap;
477
+
478
+ button {
479
+ aspect-ratio: 1 / 1;
480
+ align-items: center;
481
+ background-color: transparent;
482
+ border-radius: var(--lexxy-radius);
483
+ border: 0;
484
+ color: var(--lexxy-color-ink-inverted);
485
+ cursor: pointer;
486
+ display: flex;
487
+ font-weight: bold;
488
+ justify-content: center;
489
+ line-height: 1;
490
+ min-block-size: var(--button-size);
491
+ min-inline-size: var(--button-size);
492
+ padding: 0;
493
+
494
+ &:hover,
495
+ &:focus-visible {
496
+ background-color: var(--lexxy-color-ink-medium);
497
+ }
498
+
499
+ svg {
500
+ block-size: 1em;
501
+ inline-size: 1em;
502
+ fill: currentColor;
503
+ }
504
+
505
+ span {
506
+ display: none;
507
+ }
508
+ }
509
+ }
510
+
511
+ .lexxy-table-control__more-menu {
512
+ gap: 0;
513
+ padding: 2px;
514
+ position: relative;
515
+
516
+ summary {
517
+ aspect-ratio: 1 / 1;
518
+ align-items: center;
519
+ background: transparent;
520
+ border-radius: var(--lexxy-radius);
521
+ border: 0;
522
+ box-sizing: border-box;
523
+ display: flex;
524
+ font-size: inherit;
525
+ justify-content: center;
526
+ list-style: none;
527
+ min-block-size: var(--button-size);
528
+ min-inline-size: var(--button-size);
529
+ padding: 0;
530
+ user-select: none;
531
+ -webkit-user-select: none;
532
+
533
+ &::-webkit-details-marker {
534
+ display: none;
535
+ }
536
+
537
+ &:hover {
538
+ background: var(--lexxy-color-ink-medium);
539
+ }
540
+ }
541
+
542
+ .lexxy-table-control__more-menu-details {
543
+ display: flex;
544
+ flex-direction: column;
545
+ gap: 0.25ch;
546
+ inset-block-start: 105%;
547
+ inset-inline-start: 0;
548
+ padding: 0;
549
+ position: absolute;
550
+
551
+ .lexxy-table-control__more-menu-section {
552
+ background: var(--lexxy-color-ink);
553
+ border-radius: 0.75ch;
554
+ display: flex;
555
+ flex-direction: column;
556
+ padding: 2px;
557
+ }
558
+
559
+ button {
560
+ aspect-ratio: unset;
561
+ align-items: center;
562
+ display: flex;
563
+ flex-direction: row;
564
+ font-weight: normal;
565
+ gap: 1ch;
566
+ justify-content: flex-start;
567
+ padding: 0.5ch 2ch;
568
+ padding-inline-start: 1ch;
569
+ white-space: nowrap;
570
+
571
+ span {
572
+ display: inline-block;
573
+ }
574
+
575
+ svg {
576
+ block-size: 1.3lh;
577
+ inline-size: 1.3lh;
578
+ fill: currentColor;
579
+ }
580
+ }
581
+ }
582
+ }
583
+ }
584
+
361
585
 
362
586
  /* Language picker
363
587
  /* -------------------------------------------------------------------------- */
@@ -35,6 +35,7 @@
35
35
  --lexxy-color-selected-dark: var(--lexxy-color-blue);
36
36
  --lexxy-color-code-bg: var(--lexxy-color-ink-lightest);
37
37
 
38
+ /* Text color highlights */
38
39
  --highlight-1: rgb(136, 118, 38);
39
40
  --highlight-2: rgb(185, 94, 6);
40
41
  --highlight-3: rgb(207, 0, 0);
@@ -55,6 +56,13 @@
55
56
  --highlight-bg-8: rgba(221, 170, 123, 0.3);
56
57
  --highlight-bg-9: rgba(200, 200, 200, 0.3);
57
58
 
59
+ /* Tables */
60
+ --lexxy-color-table-header-bg: var(--lexxy-color-ink-lightest);
61
+ --lexxy-color-table-cell-border: var(--lexxy-color-ink-lighter);
62
+ --lexxy-color-table-cell-selected: var(--lexxy-color-selected);
63
+ --lexxy-color-table-cell-selected-border: highlight;
64
+ --lexxy-color-table-cell-selected-bg: highlight;
65
+
58
66
  /* Typography */
59
67
  --lexxy-font-base: system-ui, sans-serif;
60
68
  --lexxy-font-mono: ui-monospace, "Menlo", "Monaco", Consolas, monospace;
@@ -10,7 +10,7 @@ module Lexxy
10
10
  options = @options.stringify_keys
11
11
 
12
12
  add_default_name_and_id(options)
13
- options["input"] ||= dom_id(object, [ options["id"], :trix_input ].compact.join("_")) if object
13
+ options["input"] ||= @template_object.dom_id(object, [ options["id"], :trix_input ].compact.join("_")) if object
14
14
  html_tag = @template_object.lexxy_rich_textarea_tag(options.delete("name"), options.fetch("value") { value }, options.except("value"), &@block)
15
15
  error_wrapping(html_tag)
16
16
  end
data/lib/lexxy/engine.rb CHANGED
@@ -36,10 +36,12 @@ module Lexxy
36
36
  initializer "lexxy.sanitization" do |app|
37
37
  ActiveSupport.on_load(:action_text_content) do
38
38
  default_allowed_tags = Class.new.include(ActionText::ContentHelper).new.sanitizer_allowed_tags
39
- ActionText::ContentHelper.allowed_tags = default_allowed_tags + %w[ video audio source embed ]
39
+ ActionText::ContentHelper.allowed_tags = default_allowed_tags + %w[ video audio source embed table tbody tr th td ]
40
40
 
41
41
  default_allowed_attributes = Class.new.include(ActionText::ContentHelper).new.sanitizer_allowed_attributes
42
42
  ActionText::ContentHelper.allowed_attributes = default_allowed_attributes + %w[ controls poster data-language style ]
43
+
44
+ Loofah::HTML5::SafeList::ALLOWED_CSS_FUNCTIONS << "var" # Allow CSS variables
43
45
  end
44
46
  end
45
47
 
@@ -21,7 +21,7 @@ module Lexxy
21
21
  alias_method :lexxy_rich_text_area_tag, :lexxy_rich_textarea_tag
22
22
 
23
23
  private
24
- # Tempoary: we need to *adaptarize* action text
24
+ # Temporary: we need to *adaptarize* action text
25
25
  def render_custom_attachments_in(value)
26
26
  if value.respond_to?(:body)
27
27
  if html = value.body_before_type_cast.presence
data/lib/lexxy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lexxy
2
- VERSION = "0.1.23.beta"
2
+ VERSION = "0.1.25.beta"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lexxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.23.beta
4
+ version: 0.1.25.beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jorge Manrubia
@@ -120,6 +120,7 @@ files:
120
120
  - app/assets/javascript/lexxy.js
121
121
  - app/assets/javascript/lexxy.js.br
122
122
  - app/assets/javascript/lexxy.js.gz
123
+ - app/assets/javascript/lexxy.js.map
123
124
  - app/assets/javascript/lexxy.min.js
124
125
  - app/assets/javascript/lexxy.min.js.br
125
126
  - app/assets/javascript/lexxy.min.js.gz
@@ -127,17 +128,8 @@ files:
127
128
  - app/assets/stylesheets/lexxy-editor.css
128
129
  - app/assets/stylesheets/lexxy-variables.css
129
130
  - app/assets/stylesheets/lexxy.css
130
- - app/controllers/actiontext/lexical/application_controller.rb
131
- - app/helpers/actiontext/lexical/application_helper.rb
132
- - app/jobs/actiontext/lexical/application_job.rb
133
- - app/models/actiontext/lexical/application_record.rb
134
131
  - app/views/action_text/attachables/_remote_video.html.erb
135
- - app/views/layouts/actiontext/lexical/application.html.erb
136
- - app/views/people/_person.html.erb
137
- - app/views/people/_prompt_item.html.erb
138
- - app/views/people/index.html.erb
139
132
  - config/ci.rb
140
- - config/routes.rb
141
133
  - lib/action_text/attachables/remote_video.rb
142
134
  - lib/active_storage/blob_with_preview_url.rb
143
135
  - lib/lexxy.rb
@@ -1,6 +0,0 @@
1
- module Actiontext
2
- module Lexical
3
- class ApplicationController < ActionController::Base
4
- end
5
- end
6
- end
@@ -1,6 +0,0 @@
1
- module Actiontext
2
- module Lexical
3
- module ApplicationHelper
4
- end
5
- end
6
- end
@@ -1,6 +0,0 @@
1
- module Actiontext
2
- module Lexical
3
- class ApplicationJob < ActiveJob::Base
4
- end
5
- end
6
- end
@@ -1,7 +0,0 @@
1
- module Actiontext
2
- module Lexical
3
- class ApplicationRecord < ActiveRecord::Base
4
- self.abstract_class = true
5
- end
6
- end
7
- end
@@ -1,17 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Actiontext lexical</title>
5
- <%= csrf_meta_tags %>
6
- <%= csp_meta_tag %>
7
-
8
- <%= yield :head %>
9
-
10
- <%= stylesheet_link_tag "actiontext/lexical/application", media: "all" %>
11
- </head>
12
- <body>
13
-
14
- <%= yield %>
15
-
16
- </body>
17
- </html>
@@ -1 +0,0 @@
1
- <em><%= person.name %></em> (<strong><%= person.initials %></strong>)
@@ -1,6 +0,0 @@
1
- <lexxy-prompt-item search="<%= "#{person.name} #{person.initials}" %>" sgid="<%= person.attachable_sgid %>">
2
- <template type="menu"><%= person.name %></template>
3
- <template type="editor">
4
- <%= render "people/person", person: person %>
5
- </template>
6
- </lexxy-prompt-item>
@@ -1,3 +0,0 @@
1
- <% @people.each do |person| %>
2
- <%= render "people/prompt_item", person: person %>
3
- <% end %>
data/config/routes.rb DELETED
@@ -1,2 +0,0 @@
1
- Lexxy::Engine.routes.draw do
2
- end