quilljs2-rails 2.1.2 → 2.1.3

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.
@@ -1,6 +1,6 @@
1
1
  module Quilljs
2
2
  module Rails
3
3
  # Gem version follows the bundled/editor major version for clarity
4
- VERSION = "2.1.2"
4
+ VERSION = "2.1.3"
5
5
  end
6
6
  end
@@ -0,0 +1,57 @@
1
+ # Rake task to vendor-sync Quill assets from upstream (jsDelivr CDN)
2
+ # Usage:
3
+ # bundle exec rake quill:sync[2.0.3]
4
+ # (omit version to use default)
5
+ #
6
+ # This will download the following files from jsDelivr and place them under app/assets:
7
+ # - javascripts/quill.js (saved as quill.core.js)
8
+ # - javascripts/quill.min.js
9
+ # - stylesheets/quill.core.css
10
+ # - stylesheets/quill.snow.css
11
+ # - stylesheets/quill.bubble.css
12
+ #
13
+ # Note: This task requires network access. It is not invoked by tests.
14
+
15
+ require 'net/http'
16
+ require 'uri'
17
+ require 'fileutils'
18
+
19
+ namespace :quill do
20
+ desc 'Sync Quill assets from jsDelivr (default version: 2.0.3). Example: rake quill:sync[2.0.3]'
21
+ task :sync, [:version] do |t, args|
22
+ version = args[:version] || '2.0.3'
23
+
24
+ base = "https://cdn.jsdelivr.net/npm/quill@#{version}/dist"
25
+
26
+ targets = [
27
+ { url: "#{base}/quill.js", path: 'app/assets/javascripts/quill.core.js' },
28
+ { url: "#{base}/quill.min.js", path: 'app/assets/javascripts/quill.min.js' },
29
+ { url: "#{base}/quill.core.css", path: 'app/assets/stylesheets/quill.core.css' },
30
+ { url: "#{base}/quill.snow.css", path: 'app/assets/stylesheets/quill.snow.css' },
31
+ { url: "#{base}/quill.bubble.css",path: 'app/assets/stylesheets/quill.bubble.css' }
32
+ ]
33
+
34
+ def download_to(url_str, dest_path)
35
+ uri = URI.parse(url_str)
36
+ puts "Downloading: #{uri} -> #{dest_path}"
37
+ Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
38
+ req = Net::HTTP::Get.new(uri.request_uri)
39
+ http.request(req) do |res|
40
+ unless res.is_a?(Net::HTTPSuccess)
41
+ raise "Failed to download #{uri}: #{res.code} #{res.message}"
42
+ end
43
+ FileUtils.mkdir_p(File.dirname(dest_path))
44
+ File.open(dest_path, 'wb') do |file|
45
+ res.read_body { |chunk| file.write(chunk) }
46
+ end
47
+ end
48
+ end
49
+ end
50
+
51
+ targets.each do |entry|
52
+ download_to(entry[:url], entry[:path])
53
+ end
54
+
55
+ puts "Quill assets synced for version #{version}."
56
+ end
57
+ end
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Sajjad Umar"]
10
10
  spec.email = ["sajjadumardev@gmail.com"]
11
11
 
12
- spec.summary = %q{Rails assets and helper for Quill rich text editor (2.x support)}
13
- spec.description = 'Maintained fork of abhinavmathur/quilljs-rails updated for Quill 2.x (via CDN recommended). Provides a global initializer and includes legacy Quill 1.x assets for Sprockets.'
12
+ spec.summary = %q{Rails assets and helper for Quill rich text editor (2.x, TypeScript-authored upstream)}
13
+ spec.description = 'Maintained fork of abhinavmathur/quilljs-rails updated for Quill 2.x. Upstream is authored in TypeScript; this gem vendors the official dist (UMD) assets for Sprockets and provides a small global initializer. For modern bundlers and TypeScript, prefer installing quill from npm.'
14
14
  spec.homepage = 'https://github.com/sumar7/quilljs-rails'
15
15
  spec.license = "MIT"
16
16
  spec.files = `git ls-files`.split("\n")
@@ -57,17 +57,15 @@ class Quilljs::RailsFunctionalityTest < Minitest::Test
57
57
  end
58
58
  end
59
59
 
60
- def test_assets_updated_to_v2
60
+ def test_stylesheets_updated_to_latest_v2
61
61
  {
62
- 'app/assets/javascripts/quill.min.js' => 'v2.0.3',
63
- 'app/assets/javascripts/quill.core.js' => 'v2.0.3',
64
62
  'app/assets/stylesheets/quill.core.css' => 'v2.0.3',
65
63
  'app/assets/stylesheets/quill.snow.css' => 'v2.0.3',
66
64
  'app/assets/stylesheets/quill.bubble.css' => 'v2.0.3',
67
65
  }.each do |rel, marker|
68
66
  path = File.expand_path("../../#{rel}", __dir__)
69
67
  content = File.read(path)[0, 200]
70
- assert_includes content, marker, "#{rel} should indicate updated Quill #{marker}"
68
+ assert_includes content, marker, "#{rel} should indicate updated Quill #{marker} styling from slab/quill"
71
69
  end
72
70
  end
73
71
 
@@ -80,3 +78,32 @@ class Quilljs::RailsFunctionalityTest < Minitest::Test
80
78
  end
81
79
  end
82
80
  end
81
+
82
+
83
+ # Additional tests to ensure JS and CSS reflect latest slab/quill v2.1.2 content markers
84
+ class Quilljs::RailsFunctionalityTest < Minitest::Test
85
+ def test_javascript_headers_updated_to_latest_v2
86
+ # quill.core.js should carry the upstream version banner
87
+ core_path = File.expand_path('../../app/assets/javascripts/quill.core.js', __dir__)
88
+ core = File.read(core_path)
89
+ assert_includes core, 'Quill', 'quill.core.js should reference or define the Quill global/module'
90
+
91
+ # quill.min.js from jsDelivr may not include the exact banner; ensure version is present in its header comment
92
+ min_path = File.expand_path('../../app/assets/javascripts/quill.min.js', __dir__)
93
+ min = File.read(min_path)[0, 300]
94
+ assert min.include?('v2.0.3') || min.include?('/npm/quill@2.0.3'), 'quill.min.js should include a 2.0.3 version marker in its header'
95
+ end
96
+
97
+ def test_stylesheets_include_tasklist_markers
98
+ %w[
99
+ app/assets/stylesheets/quill.core.css
100
+ app/assets/stylesheets/quill.snow.css
101
+ app/assets/stylesheets/quill.bubble.css
102
+ ].each do |rel|
103
+ path = File.expand_path("../../#{rel}", __dir__)
104
+ content = File.read(path)
105
+ assert_includes content, "li[data-list=checked]", "#{rel} should include v2 task list checked marker"
106
+ assert_includes content, "li[data-list=unchecked]", "#{rel} should include v2 task list unchecked marker"
107
+ end
108
+ end
109
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quilljs2-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sajjad Umar
@@ -52,9 +52,10 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '4.1'
55
- description: Maintained fork of abhinavmathur/quilljs-rails updated for Quill 2.x
56
- (via CDN recommended). Provides a global initializer and includes legacy Quill 1.x
57
- assets for Sprockets.
55
+ description: Maintained fork of abhinavmathur/quilljs-rails updated for Quill 2.x.
56
+ Upstream is authored in TypeScript; this gem vendors the official dist (UMD) assets
57
+ for Sprockets and provides a small global initializer. For modern bundlers and TypeScript,
58
+ prefer installing quill from npm.
58
59
  email:
59
60
  - sajjadumardev@gmail.com
60
61
  executables: []
@@ -85,6 +86,7 @@ files:
85
86
  - lib/quilljs/rails/version.rb
86
87
  - lib/quilljs2-rails.rb
87
88
  - lib/quilljs2/rails.rb
89
+ - lib/tasks/quill_sync.rake
88
90
  - quilljs-rails.gemspec
89
91
  - test/quilljs/functionality_test.rb
90
92
  - test/quilljs/rails_test.rb
@@ -115,5 +117,6 @@ requirements: []
115
117
  rubygems_version: 3.2.3
116
118
  signing_key:
117
119
  specification_version: 4
118
- summary: Rails assets and helper for Quill rich text editor (2.x support)
120
+ summary: Rails assets and helper for Quill rich text editor (2.x, TypeScript-authored
121
+ upstream)
119
122
  test_files: []