lexxy 0.9.2.beta → 0.9.4.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
@@ -637,23 +637,19 @@
637
637
 
638
638
  lexxy-link-dropdown {
639
639
  font-size: var(--lexxy-text-small);
640
+ gap: var(--lexxy-toolbar-spacing);
640
641
  inset-inline-start: var(--lexxy-toolbar-spacing);
641
642
  inset-inline-end: var(--lexxy-toolbar-spacing);
642
643
 
643
- form {
644
- display: flex;
645
- flex: 1;
646
- gap: var(--lexxy-toolbar-spacing);
647
-
648
- [overflowing] & {
649
- display: block;
644
+ [overflowing] [open] & {
645
+ display: block;
650
646
 
651
- .lexxy-editor__toolbar-dropdown-actions {
652
- margin-block-start: var(--lexxy-toolbar-spacing);
653
- }
647
+ .lexxy-editor__toolbar-dropdown-actions {
648
+ margin-block-start: var(--lexxy-toolbar-spacing);
654
649
  }
655
650
  }
656
651
 
652
+
657
653
  .lexxy-editor__toolbar-dropdown-actions {
658
654
  display: flex;
659
655
  flex: 1;
@@ -681,7 +677,7 @@
681
677
  padding-inline: 2ch;
682
678
  }
683
679
 
684
- button[type="submit"] {
680
+ button[value="link"] {
685
681
  background-color: var(--lexxy-color-accent-dark);
686
682
  color: var(--lexxy-color-ink-inverted);
687
683
 
@@ -1022,6 +1018,7 @@
1022
1018
  &[data-clipped-at-right] {
1023
1019
  inset-inline-start: unset;
1024
1020
  inset-inline-end: 1ch;
1021
+ max-inline-size: calc(100% - 1ch);
1025
1022
  }
1026
1023
 
1027
1024
  &[data-clipped-at-bottom] {
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActionText
4
+ class Editor::LexxyEditor < Editor
5
+ def editor_tag(...)
6
+ Tag.new(editor_name, ...)
7
+ end
8
+ end
9
+
10
+ class Editor::LexxyEditor::Tag < Editor::Tag
11
+ def render_in(view_context, ...)
12
+ # Strip html_safe to preserve attribute escaping (see #749)
13
+ options[:value] = options[:value].to_str if options[:value].respond_to?(:to_str)
14
+ super
15
+ end
16
+ end
17
+ end
data/lib/lexxy/engine.rb CHANGED
@@ -1,7 +1,3 @@
1
- require_relative "rich_text_area_tag"
2
- require_relative "form_helper"
3
- require_relative "form_builder"
4
- require_relative "action_text_tag"
5
1
  require_relative "attachable"
6
2
 
7
3
  require "active_storage/blob_with_preview_url"
@@ -11,18 +7,37 @@ module Lexxy
11
7
  isolate_namespace Lexxy
12
8
 
13
9
  config.lexxy = ActiveSupport::OrderedOptions.new
14
- config.lexxy.override_action_text_defaults = true
15
10
 
16
- initializer "lexxy.initialize" do |app|
11
+ if Lexxy.supports_editor_adapter?
12
+ require_relative "../action_text/editor/lexxy_editor"
13
+
14
+ initializer "lexxy.action_text_editor", before: "action_text.editors" do |app|
15
+ app.config.action_text.editors[:lexxy] = {}
16
+ end
17
+ else
18
+ # Rails 8.0/8.1 fallback: monkey-patch Action Text helpers
19
+ require_relative "rich_text_area_tag"
20
+ require_relative "form_helper"
21
+ require_relative "form_builder"
22
+ require_relative "action_text_tag"
23
+
24
+ config.lexxy.override_action_text_defaults = true
25
+
26
+ initializer "lexxy.initialize" do |app|
27
+ app.config.to_prepare do
28
+ ActionText::TagHelper.prepend(Lexxy::TagHelper)
29
+ ActionView::Helpers::FormHelper.prepend(Lexxy::FormHelper)
30
+ ActionView::Helpers::FormBuilder.prepend(Lexxy::FormBuilder)
31
+ ActionView::Helpers::Tags::ActionText.prepend(Lexxy::ActionTextTag)
32
+
33
+ Lexxy.override_action_text_defaults if app.config.lexxy.override_action_text_defaults
34
+ end
35
+ end
36
+ end
37
+
38
+ initializer "lexxy.attachable" do |app|
17
39
  app.config.to_prepare do
18
- # TODO: We need to move these extensions to Action Text
19
- ActionText::TagHelper.prepend(Lexxy::TagHelper)
20
- ActionView::Helpers::FormHelper.prepend(Lexxy::FormHelper)
21
- ActionView::Helpers::FormBuilder.prepend(Lexxy::FormBuilder)
22
- ActionView::Helpers::Tags::ActionText.prepend(Lexxy::ActionTextTag)
23
40
  ActionText::Attachable.singleton_class.prepend(Lexxy::Attachable)
24
-
25
- Lexxy.override_action_text_defaults if app.config.lexxy.override_action_text_defaults
26
41
  end
27
42
  end
28
43
 
@@ -41,7 +56,7 @@ module Lexxy
41
56
  default_allowed_attributes = Class.new.include(ActionText::ContentHelper).new.sanitizer_allowed_attributes
42
57
  ActionText::ContentHelper.allowed_attributes = default_allowed_attributes + %w[ controls poster data-language style ]
43
58
 
44
- Loofah::HTML5::SafeList::ALLOWED_CSS_FUNCTIONS << "var" # Allow CSS variables
59
+ Loofah::HTML5::SafeList::ALLOWED_CSS_FUNCTIONS << "var"
45
60
  end
46
61
  end
47
62
 
data/lib/lexxy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lexxy
2
- VERSION = "0.9.2.beta"
2
+ VERSION = "0.9.4.beta"
3
3
  end
data/lib/lexxy.rb CHANGED
@@ -1,25 +1,33 @@
1
1
  require "lexxy/version"
2
- require "lexxy/engine"
3
2
 
4
3
  module Lexxy
5
- def self.override_action_text_defaults
6
- ActionText::TagHelper.module_eval do
7
- alias_method :rich_textarea_tag, :lexxy_rich_textarea_tag
8
- alias_method :rich_text_area_tag, :lexxy_rich_textarea_tag
4
+ class << self
5
+ # Check for ActionText::Editor with block-children support (rails/rails#56926)
6
+ def supports_editor_adapter?
7
+ !!(defined?(ActionText::Editor) && ActionText::Editor.instance_method(:editor_tag).parameters.assoc(:block))
9
8
  end
10
9
 
11
- ActionView::Helpers::FormHelper.module_eval do
12
- alias_method :rich_textarea, :lexxy_rich_textarea
13
- alias_method :rich_text_area, :lexxy_rich_textarea
14
- end
10
+ def override_action_text_defaults
11
+ ActionText::TagHelper.module_eval do
12
+ alias_method :rich_textarea_tag, :lexxy_rich_textarea_tag
13
+ alias_method :rich_text_area_tag, :lexxy_rich_textarea_tag
14
+ end
15
15
 
16
- ActionView::Helpers::FormBuilder.module_eval do
17
- alias_method :rich_textarea, :lexxy_rich_textarea
18
- alias_method :rich_text_area, :lexxy_rich_textarea
19
- end
16
+ ActionView::Helpers::FormHelper.module_eval do
17
+ alias_method :rich_textarea, :lexxy_rich_textarea
18
+ alias_method :rich_text_area, :lexxy_rich_textarea
19
+ end
20
20
 
21
- ActionView::Helpers::Tags::ActionText.module_eval do
22
- alias_method :render, :lexxy_render
21
+ ActionView::Helpers::FormBuilder.module_eval do
22
+ alias_method :rich_textarea, :lexxy_rich_textarea
23
+ alias_method :rich_text_area, :lexxy_rich_textarea
24
+ end
25
+
26
+ ActionView::Helpers::Tags::ActionText.module_eval do
27
+ alias_method :render, :lexxy_render
28
+ end
23
29
  end
24
30
  end
25
31
  end
32
+
33
+ require "lexxy/engine"
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.9.2.beta
4
+ version: 0.9.4.beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jorge Manrubia
@@ -27,86 +27,86 @@ dependencies:
27
27
  name: turbo-rails
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
- - - ">="
30
+ - - "~>"
31
31
  - !ruby/object:Gem::Version
32
- version: '0'
32
+ version: '2.0'
33
33
  type: :development
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ">="
37
+ - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0'
39
+ version: '2.0'
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: stimulus-rails
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - ">="
44
+ - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '0'
46
+ version: '1.0'
47
47
  type: :development
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - ">="
51
+ - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '0'
53
+ version: '1.0'
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: capybara
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - ">="
58
+ - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '0'
60
+ version: '3.0'
61
61
  type: :development
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - ">="
65
+ - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '0'
67
+ version: '3.0'
68
68
  - !ruby/object:Gem::Dependency
69
69
  name: selenium-webdriver
70
70
  requirement: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ">="
72
+ - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '0'
74
+ version: '4.0'
75
75
  type: :development
76
76
  prerelease: false
77
77
  version_requirements: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ">="
79
+ - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '0'
81
+ version: '4.0'
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: cuprite
84
84
  requirement: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - ">="
86
+ - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: '0'
88
+ version: '0.17'
89
89
  type: :development
90
90
  prerelease: false
91
91
  version_requirements: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - ">="
93
+ - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: '0'
95
+ version: '0.17'
96
96
  - !ruby/object:Gem::Dependency
97
97
  name: image_processing
98
98
  requirement: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - ">="
100
+ - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: '0'
102
+ version: '1.0'
103
103
  type: :development
104
104
  prerelease: false
105
105
  version_requirements: !ruby/object:Gem::Requirement
106
106
  requirements:
107
- - - ">="
107
+ - - "~>"
108
108
  - !ruby/object:Gem::Version
109
- version: '0'
109
+ version: '1.0'
110
110
  description: A new editor for Action Text based on Meta's Lexical framework.
111
111
  email:
112
112
  - jorge@37signals.com
@@ -133,6 +133,7 @@ files:
133
133
  - config/ci.rb
134
134
  - ext/Rakefile
135
135
  - lib/action_text/attachables/remote_video.rb
136
+ - lib/action_text/editor/lexxy_editor.rb
136
137
  - lib/active_storage/blob_with_preview_url.rb
137
138
  - lib/lexxy.rb
138
139
  - lib/lexxy/action_text_tag.rb