lexxy 0.1.13.beta → 0.1.14.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
@@ -44,6 +44,10 @@
44
44
  .lexxy-content__bold {
45
45
  font-weight: bold;
46
46
  }
47
+
48
+ .lexxy-content__strikethrough {
49
+ text-decoration: line-through;
50
+ }
47
51
 
48
52
  .lexxy-content__underline {
49
53
  text-decoration: underline;
@@ -60,6 +64,10 @@
60
64
  display: none;
61
65
  }
62
66
 
67
+ a {
68
+ color: var(--lexxy-color-link);
69
+ }
70
+
63
71
  img,
64
72
  video,
65
73
  embed,
@@ -204,7 +212,8 @@
204
212
  font-size: var(--lexxy-text-small);
205
213
 
206
214
  input {
207
- color: inherit;
215
+ background: var(--lexxy-color-canvas);
216
+ color: var(--lexxy-color-text);
208
217
  border: none;
209
218
  inline-size: 100%;
210
219
  max-inline-size: 100%;
@@ -328,6 +337,20 @@
328
337
  --lexxy-attachment-icon-color: var(--lexxy-color-green);
329
338
  }
330
339
 
340
+ /* Horizontal divider */
341
+ :where(.horizontal-divider) {
342
+ margin: 0;
343
+ margin-block-end: .5em;
344
+ padding: 1.5em 0 .5em;
345
+
346
+ hr {
347
+ border: 0;
348
+ border-block-end: 1px solid currentColor;
349
+ inline-size: 20%;
350
+ margin: 0;
351
+ }
352
+ }
353
+
331
354
  /* Custom attachments such as mentions, etc. */
332
355
  :where(action-text-attachment[content-type^="application/vnd.actiontext"]) {
333
356
  --lexxy-attachment-bg-color: transparent;
@@ -11,6 +11,7 @@
11
11
 
12
12
  border: 1px solid var(--lexxy-color-ink-lighter);
13
13
  border-radius: calc(var(--lexxy-radius) + var(--lexxy-toolbar-gap));
14
+ background-color: var(--lexxy-color-canvas);
14
15
  display: block;
15
16
  overflow: visible;
16
17
  position: relative;
@@ -35,8 +36,8 @@
35
36
  inline-size: auto;
36
37
 
37
38
  @media(any-hover: hover) {
38
- &:hover {
39
- filter: brightness(0.9);
39
+ &:hover:not([aria-disabled="true"]) {
40
+ background: var(--lexxy-color-ink-lightest);
40
41
  }
41
42
  }
42
43
  }
@@ -93,6 +94,10 @@
93
94
  max-inline-size: 100%;
94
95
  padding: 2px;
95
96
  position: relative;
97
+
98
+ &[data-attachments="false"] button[name="upload"]{
99
+ display: none;
100
+ }
96
101
  }
97
102
 
98
103
  :where(.lexxy-editor__toolbar-button) {
@@ -102,12 +107,18 @@
102
107
  display: grid;
103
108
  place-items: center;
104
109
 
105
- &:is(:active) {
110
+ &:is(:active):not([aria-disabled="true"]),
111
+ &[aria-pressed="true"] {
106
112
  background-color: var(--lexxy-color-selected);
113
+
114
+ &:hover {
115
+ background-color: var(--lexxy-color-selected-hover);
116
+ }
107
117
  }
108
118
 
109
- &[aria-pressed="true"] {
110
- background-color: var(--lexxy-color-selected);
119
+ &[aria-disabled="true"] {
120
+ cursor: default;
121
+ opacity: 0.3;
111
122
  }
112
123
 
113
124
  svg {
@@ -120,8 +131,18 @@
120
131
  }
121
132
  }
122
133
 
134
+ :where(.lexxy-editor__toolbar-spacer) {
135
+ flex: 1;
136
+ }
137
+
138
+ /* Make sure spacer is only displayed if there's another button before it */
139
+ * + :where(.lexxy-editor__toolbar-spacer) {
140
+ min-inline-size: 1lh;
141
+ }
142
+
123
143
  :where(.lexxy-editor__toolbar-overflow) {
124
144
  display: none;
145
+ justify-self: flex-end;
125
146
  position: relative;
126
147
  z-index: 1;
127
148
 
@@ -133,7 +154,7 @@
133
154
  }
134
155
 
135
156
  [open] & {
136
- filter: brightness(0.9);
157
+ background-color: var(--lexxy-color-ink-lightest);
137
158
  }
138
159
  }
139
160
  }
@@ -180,13 +201,16 @@
180
201
  }
181
202
 
182
203
  input[type="url"] {
204
+ background-color: var(--lexxy-color-canvas);
183
205
  border: 1px solid var(--lexxy-color-ink-lighter);
184
206
  border-radius: var(--lexxy-radius);
207
+ color: var(--lexxy-color-text);
185
208
  min-inline-size: 30ch;
186
209
  }
187
210
 
188
211
  button {
189
212
  background-color: var(--lexxy-color-ink-lightest);
213
+ color: var(--lexxy-color-text);
190
214
  inline-size: 100%;
191
215
  justify-content: center;
192
216
  }
@@ -8,7 +8,8 @@
8
8
  --lexxy-color-ink-inverted: white;
9
9
 
10
10
  --lexxy-color-accent-dark: oklch(57% 0.19 260);
11
- --lexxy-color-accent-medium: oklch(66% 0.196 258);
11
+ --lexxy-color-accent-medium: oklch(75% 0.196 258);
12
+ --lexxy-color-accent-light: oklch(88% 0.026 254);
12
13
  --lexxy-color-accent-lightest: oklch(92% 0.026 254);
13
14
 
14
15
  --lexxy-color-red: oklch(60% 0.15 27);
@@ -30,7 +31,8 @@
30
31
  --lexxy-color-text-subtle: var(--lexxy-color-ink-medium);
31
32
  --lexxy-color-link: var(--lexxy-color-accent-dark);
32
33
  --lexxy-color-selected: var(--lexxy-color-accent-lightest);
33
- --lexxy-color-selected-dark: var(--lexxy-color-blue-medium);
34
+ --lexxy-color-selected-hover: var(--lexxy-color-accent-light);
35
+ --lexxy-color-selected-dark: var(--lexxy-color-blue);
34
36
  --lexxy-color-code-bg: var(--lexxy-color-ink-lightest);
35
37
 
36
38
  /* Typography */
@@ -48,4 +50,4 @@
48
50
  --lexxy-radius: 0.5ch;
49
51
  --lexxy-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
50
52
  --lexxy-z-popup: 1000;
51
- }
53
+ }
@@ -0,0 +1,10 @@
1
+ <figure class="attachment attachment--preview attachment--video">
2
+ <video controls<%= " width=\"#{remote_video.width}\"" if remote_video.width %><%= " height=\"#{remote_video.height}\"" if remote_video.height %>>
3
+ <source src="<%= remote_video.url %>" type="<%= remote_video.content_type %>">
4
+ </video>
5
+ <% if caption = remote_video.try(:caption) %>
6
+ <figcaption class="attachment__caption">
7
+ <%= caption %>
8
+ </figcaption>
9
+ <% end %>
10
+ </figure>
@@ -0,0 +1,46 @@
1
+ module ActionText
2
+ module Attachables
3
+ class RemoteVideo
4
+ extend ActiveModel::Naming
5
+
6
+ class << self
7
+ def from_node(node)
8
+ if node["url"] && content_type_is_video?(node["content-type"])
9
+ new(attributes_from_node(node))
10
+ end
11
+ end
12
+
13
+ private
14
+ def content_type_is_video?(content_type)
15
+ content_type.to_s.match?(/^video(\/.+|$)/)
16
+ end
17
+
18
+ def attributes_from_node(node)
19
+ { url: node["url"],
20
+ content_type: node["content-type"],
21
+ width: node["width"],
22
+ height: node["height"],
23
+ filename: node["filename"] }
24
+ end
25
+ end
26
+
27
+ attr_reader :url, :content_type, :width, :height, :filename
28
+
29
+ def initialize(attributes = {})
30
+ @url = attributes[:url]
31
+ @content_type = attributes[:content_type]
32
+ @width = attributes[:width]
33
+ @height = attributes[:height]
34
+ @filename = attributes[:filename]
35
+ end
36
+
37
+ def attachable_plain_text_representation(caption)
38
+ "[#{caption || filename || "Video"}]"
39
+ end
40
+
41
+ def to_partial_path
42
+ "action_text/attachables/remote_video"
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,15 @@
1
+ require "action_text/attachables/remote_video"
2
+
3
+ module Lexxy
4
+ module Attachable
5
+ def from_node(node)
6
+ attachable = super
7
+
8
+ if attachable.is_a?(ActionText::Attachables::MissingAttachable)
9
+ ActionText::Attachables::RemoteVideo.from_node(node) || attachable
10
+ else
11
+ attachable
12
+ end
13
+ end
14
+ end
15
+ end
data/lib/lexxy/engine.rb CHANGED
@@ -2,6 +2,7 @@ require_relative "rich_text_area_tag"
2
2
  require_relative "form_helper"
3
3
  require_relative "form_builder"
4
4
  require_relative "action_text_tag"
5
+ require_relative "attachable"
5
6
 
6
7
  require "active_storage/blob_with_preview_url"
7
8
 
@@ -19,6 +20,7 @@ module Lexxy
19
20
  ActionView::Helpers::FormHelper.prepend(Lexxy::FormHelper)
20
21
  ActionView::Helpers::FormBuilder.prepend(Lexxy::FormBuilder)
21
22
  ActionView::Helpers::Tags::ActionText.prepend(Lexxy::ActionTextTag)
23
+ ActionText::Attachable.singleton_class.prepend(Lexxy::Attachable)
22
24
 
23
25
  Lexxy.override_action_text_defaults if app.config.lexxy.override_action_text_defaults
24
26
  end
@@ -23,14 +23,18 @@ module Lexxy
23
23
  private
24
24
  # Tempoary: we need to *adaptarize* action text
25
25
  def render_custom_attachments_in(value)
26
- if html = value.try(:body_before_type_cast).presence
27
- ActionText::Fragment.wrap(html).replace(ActionText::Attachment.tag_name) do |node|
28
- if node["url"].blank?
29
- attachment = ActionText::Attachment.from_node(node)
30
- node["content"] = render_action_text_attachment(attachment).to_json
26
+ if value.respond_to?(:body)
27
+ if html = value.body_before_type_cast.presence
28
+ ActionText::Fragment.wrap(html).replace(ActionText::Attachment.tag_name) do |node|
29
+ if node["url"].blank?
30
+ attachment = ActionText::Attachment.from_node(node)
31
+ node["content"] = render_action_text_attachment(attachment).to_json
32
+ end
33
+ node
31
34
  end
32
- node
33
35
  end
36
+ else
37
+ value
34
38
  end
35
39
  end
36
40
  end
data/lib/lexxy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lexxy
2
- VERSION = "0.1.13.beta"
2
+ VERSION = "0.1.14.beta"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lexxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13.beta
4
+ version: 0.1.14.beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jorge Manrubia
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-10-10 00:00:00.000000000 Z
10
+ date: 2025-11-01 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails
@@ -131,14 +131,17 @@ files:
131
131
  - app/helpers/actiontext/lexical/application_helper.rb
132
132
  - app/jobs/actiontext/lexical/application_job.rb
133
133
  - app/models/actiontext/lexical/application_record.rb
134
+ - app/views/action_text/attachables/_remote_video.html.erb
134
135
  - app/views/layouts/actiontext/lexical/application.html.erb
135
136
  - app/views/people/_person.html.erb
136
137
  - app/views/people/_prompt_item.html.erb
137
138
  - app/views/people/index.html.erb
138
139
  - config/routes.rb
140
+ - lib/action_text/attachables/remote_video.rb
139
141
  - lib/active_storage/blob_with_preview_url.rb
140
142
  - lib/lexxy.rb
141
143
  - lib/lexxy/action_text_tag.rb
144
+ - lib/lexxy/attachable.rb
142
145
  - lib/lexxy/engine.rb
143
146
  - lib/lexxy/form_builder.rb
144
147
  - lib/lexxy/form_helper.rb