maglevcms 1.7.3 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7a5b69c183e753d7c6e87e9904d992bbe039901a35d5b0c2cc2c779bb1546469
4
- data.tar.gz: '09c9e5973720db3a1038855d0e0e9417f8f9f5d678a7c89651941aa08afff560'
3
+ metadata.gz: b5f367edf49a70fcab89dd3906037a4d7e1b4711c50fd9a5b255f526f78262ec
4
+ data.tar.gz: e041ca5f4be377ba43ab62b8ac86835e6c2cb4079e77274a50966b231a41098d
5
5
  SHA512:
6
- metadata.gz: c56abbaa2a811d82eeb9894de80a708f640f8c38689c06ffac91a4eb806484f42dfa28123daab5d5651bbc86ab934f68525f00763a339f2395030ae2454311e2
7
- data.tar.gz: b08119217e120672a3da43bd56aab08399940521f0052bffe25407e4b7a99eb17fe6b23d2aac72767b02785566acd8105728c7ef21fe5cc2b6aae74a7f94e2ef
6
+ metadata.gz: 12e159b397754772159e3dfa9531d3cb147b7b73d2f0006452acce3f34aec256a9f66cbbcc5d054c2518dc6bcc476af5f382965835806255a4769426bfe4d1fe
7
+ data.tar.gz: 6837950bdf76d44df4a2ede9a4c417010714631a03b7cab000edb5ff5e8c194f913c82281915361c20680ed6bc84c1ab9799fb02efb6f137a5e734980cb8264d
Binary file
data/Rakefile CHANGED
@@ -20,7 +20,8 @@ require 'vite_ruby'
20
20
  ViteRuby.install_tasks
21
21
  ViteRuby.config.root # Ensure the engine is set as the root.
22
22
 
23
- APP_RAKEFILE = File.expand_path('spec/dummy/Rakefile', __dir__)
23
+ rakefile_path = Rails::VERSION::MAJOR >= 8 ? 'spec/dummy/Rakefile' : 'spec/legacy_dummy/Rakefile'
24
+ APP_RAKEFILE = File.expand_path(rakefile_path, __dir__)
24
25
  load 'rails/tasks/engine.rake'
25
26
  load 'rails/tasks/statistics.rake'
26
27
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  module Maglev
4
4
  class BaseComponent
5
+ include ::Maglev::Inspector
6
+
5
7
  extend Forwardable
6
8
  def_delegators :view_context, :render
7
9
 
@@ -50,5 +52,9 @@ module Maglev
50
52
  rescue NoMethodError
51
53
  raise "[Maglev] We're sorry but there is no '#{setting_id}' setting in your section/block."
52
54
  end
55
+
56
+ def site_id
57
+ site.id
58
+ end
53
59
  end
54
60
  end
@@ -42,5 +42,15 @@ module Maglev
42
42
  def tag_data
43
43
  { maglev_block_id: id }
44
44
  end
45
+
46
+ private
47
+
48
+ def section_id
49
+ section.id
50
+ end
51
+
52
+ def inspect_fields
53
+ %w[id site_id section_id name type].map { |field| [field, send(field)] }
54
+ end
45
55
  end
46
56
  end
@@ -3,6 +3,8 @@
3
3
  module Maglev
4
4
  module Content
5
5
  class Base
6
+ include ::Maglev::Inspector
7
+
6
8
  extend Forwardable
7
9
  def_delegators :scope, :site, :config
8
10
 
@@ -47,6 +49,12 @@ module Maglev
47
49
  instance_exec(site, &config.asset_host)
48
50
  end
49
51
  end
52
+
53
+ private
54
+
55
+ def inspect_fields
56
+ %w[scope tag_id].map { |field| [field, send(field).inspect] }
57
+ end
50
58
  end
51
59
  end
52
60
  end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Maglev
4
+ module Inspector
5
+ def inspect
6
+ string = "#<#{self.class.name}:#{object_id} "
7
+ string << inspect_fields
8
+ .map { |(name, value)| "#{name}: #{value}" }
9
+ .join(', ') << '>'
10
+ end
11
+
12
+ private
13
+
14
+ def inspect_fields
15
+ []
16
+ end
17
+ end
18
+ end
@@ -42,5 +42,9 @@ module Maglev
42
42
  rendering_mode: rendering_mode
43
43
  )
44
44
  end
45
+
46
+ def inspect_fields
47
+ [['site_id', site.id], ['page_id', page.id], ['theme', theme.id]]
48
+ end
45
49
  end
46
50
  end
@@ -122,5 +122,9 @@ module Maglev
122
122
  </div>
123
123
  HTML
124
124
  end
125
+
126
+ def inspect_fields
127
+ %w[id site_id type].map { |field| [field, send(field)] }
128
+ end
125
129
  end
126
130
  end
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M5.59567 5L10.5 10.9283L15.4043 5H18L11.7978 12.4971L18 19.9943V20H15.4091L10.5 14.0659L5.59092 20H3V19.9943L9.20216 12.4971L3 5H5.59567ZM21.5507 6.5803C21.7042 6.43453 21.8 6.22845 21.8 6C21.8 5.55817 21.4418 5.2 21 5.2C20.5582 5.2 20.2 5.55817 20.2 6C20.2 6.07624 20.2107 6.14999 20.2306 6.21983L19.0765 6.54958C19.0267 6.37497 19 6.1906 19 6C19 4.89543 19.8954 4 21 4C22.1046 4 23 4.89543 23 6C23 6.57273 22.7593 7.08923 22.3735 7.45384L20.7441 9H23V10H19V9L21.5507 6.5803V6.5803Z"></path></svg>
@@ -29,7 +29,7 @@
29
29
  :isFocused="isFocused"
30
30
  :lineBreak="options.lineBreak"
31
31
  :rows="options.nbRows"
32
- :table="options.htmlTable"
32
+ :extraExtensions="options.extraExtensions"
33
33
  @blur="$emit('blur')"
34
34
  v-model="inputValue"
35
35
  v-if="setting.type == 'text' && options.html"
@@ -0,0 +1,43 @@
1
+ import { Mark } from 'tiptap'
2
+ import { toggleMark, markInputRule, markPasteRule } from 'tiptap-commands'
3
+
4
+ export default class Superscript extends Mark {
5
+
6
+ get name() {
7
+ return 'sup'
8
+ }
9
+
10
+ get schema() {
11
+ return {
12
+ parseDOM: [
13
+ {
14
+ tag: 'sup',
15
+ },
16
+ ],
17
+ toDOM: () => ['sup', 0],
18
+ }
19
+ }
20
+
21
+ keys({ type }) {
22
+ return {
23
+ 'Mod-^': toggleMark(type),
24
+ }
25
+ }
26
+
27
+ commands({ type }) {
28
+ return () => toggleMark(type)
29
+ }
30
+
31
+ // NOTE: "^^" are used as delimiters to trigger the superscript formatting
32
+ inputRules({ type }) {
33
+ return [
34
+ markInputRule(/(?:\^\^|__)([^\^*_]+)(?:\^\^|__)$/, type),
35
+ ]
36
+ }
37
+
38
+ pasteRules({ type }) {
39
+ return [
40
+ markPasteRule(/(?:\^\^|__)([^\^*_]+)(?:\^\^|__)/g, type),
41
+ ]
42
+ }
43
+ }
@@ -22,6 +22,13 @@
22
22
  :isActive="isActive.strike()"
23
23
  @click="commands.strike"
24
24
  />
25
+ <editor-menu-button
26
+ iconName="format-superscript"
27
+ class="rounded-r-sm"
28
+ :isActive="isActive.sup()"
29
+ @click="commands.sup"
30
+ v-if="extraExtensions.superscript"
31
+ />
25
32
  </div>
26
33
  </template>
27
34
 
@@ -34,6 +41,7 @@ export default {
34
41
  props: {
35
42
  commands: { type: Object, required: true },
36
43
  isActive: { type: Object, required: true },
37
- },
44
+ extraExtensions: { type: Object, default: () => ({ table: false, superscript: false }) },
45
+ }
38
46
  }
39
47
  </script>
@@ -9,7 +9,7 @@
9
9
  </div>
10
10
  <div class="mt-1">
11
11
  <editor-menu-bar :editor="editor" v-slot="{ commands, isActive }">
12
- <div class="flex sticky top-0 z-10 pb-2 bg-white space-x-1">
12
+ <div class="flex sticky top-0 z-10 pb-2 bg-white space-x-1 overflow-x-auto">
13
13
  <editor-block-button
14
14
  :commands="commands"
15
15
  :isActive="isActive"
@@ -17,7 +17,11 @@
17
17
  v-if="!lineBreak"
18
18
  />
19
19
 
20
- <editor-format-buttons :commands="commands" :isActive="isActive" />
20
+ <editor-format-buttons
21
+ :commands="commands"
22
+ :isActive="isActive"
23
+ :extraExtensions="extraExtensions"
24
+ />
21
25
 
22
26
  <editor-list-buttons
23
27
  :commands="commands"
@@ -35,7 +39,7 @@
35
39
  :commands="commands"
36
40
  :isActive="isActive"
37
41
  class="relative"
38
- v-if="!lineBreak && table"
42
+ v-if="!lineBreak && extraExtensions.table"
39
43
  />
40
44
  </div>
41
45
  </editor-menu-bar>
@@ -69,11 +73,12 @@ import {
69
73
  Table,
70
74
  TableHeader,
71
75
  TableCell,
72
- TableRow,
76
+ TableRow
73
77
  } from 'tiptap-extensions'
74
78
  import Doc from './rich-text-input/extensions/Doc'
75
79
  import LineBreak from './rich-text-input/extensions/LineBreak'
76
80
  import Link from './rich-text-input/extensions/marks/Link'
81
+ import Superscript from './rich-text-input/extensions/marks/Superscript'
77
82
  import EditorBlockButton from './rich-text-input/block-button.vue'
78
83
  import EditorFormatButtons from './rich-text-input/format-buttons.vue'
79
84
  import EditorListButtons from './rich-text-input/list-buttons.vue'
@@ -98,7 +103,7 @@ export default {
98
103
  value: { type: String },
99
104
  lineBreak: { type: Boolean, default: false },
100
105
  rows: { type: Number, default: 2 },
101
- table: { type: Boolean, default: false },
106
+ extraExtensions: { type: Object, default: () => ({ table: false, superscript: false }) },
102
107
  },
103
108
  data() {
104
109
  return { editor: null }
@@ -151,6 +156,7 @@ export default {
151
156
  new Underline(),
152
157
  new Strike(),
153
158
  new Link({ openOnClick: false, target: null }),
159
+ new Superscript(),
154
160
  new History(),
155
161
  ]
156
162
  },
@@ -0,0 +1,2 @@
1
+ import setup from 'maglev_dummy'
2
+ setup()
@@ -6,7 +6,7 @@ module Maglev::Site::LocalesConcern
6
6
 
7
7
  included do
8
8
  ## serializers ##
9
- if Rails::VERSION::MAJOR >= 7 && Rails::VERSION::MINOR.positive?
9
+ if Rails::VERSION::MAJOR >= 8 || (Rails::VERSION::MAJOR >= 7 && Rails::VERSION::MINOR.positive?)
10
10
  serialize :locales, coder: LocalesSerializer
11
11
  else
12
12
  serialize :locales, LocalesSerializer
data/config/routes.rb CHANGED
@@ -33,7 +33,7 @@ Maglev::Engine.routes.draw do
33
33
  # Admin
34
34
  namespace :admin do
35
35
  root to: 'dashboard#index'
36
- resource :theme, only: %i[index show]
36
+ resource :theme, only: %i[show]
37
37
  namespace :sections, path: 'sections/:id' do
38
38
  get :preview, to: 'previews#show'
39
39
  get :preview_in_frame, to: 'previews#iframe_show'
@@ -4,7 +4,7 @@ require 'uri'
4
4
 
5
5
  module Maglev
6
6
  class PreviewConstraint
7
- CRAWLER_USER_AGENTS = /Googlebot|Twitterbot|facebookexternalhit|LinkedInBot/o.freeze
7
+ CRAWLER_USER_AGENTS = /Googlebot|Twitterbot|facebookexternalhit|LinkedInBot/o
8
8
 
9
9
  attr_reader :preview_host
10
10
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Maglev
4
- VERSION = '1.7.3'
4
+ VERSION = '1.8.0'
5
5
  end
@@ -125,11 +125,6 @@ unless ENV['VITE_RUBY_SKIP_ASSETS_PRECOMPILE_EXTENSION'] == 'true'
125
125
  Rake::Task.define_task("assets:precompile": ['maglev:vite:install_dependencies', 'maglev:vite:build_all'])
126
126
  end
127
127
 
128
- Rake::Task.define_task('assets:clean', %i[keep age]) unless Rake::Task.task_defined?('assets:clean')
129
- Rake::Task['assets:clean'].enhance do |_, args|
130
- Rake::Task['maglev:vite:clean'].invoke(*args.to_h.values)
131
- end
132
-
133
128
  if Rake::Task.task_defined?('assets:clobber')
134
129
  Rake::Task['assets:clobber'].enhance do
135
130
  Rake::Task['maglev:vite:clobber'].invoke
data/tailwind.config.js CHANGED
@@ -6,7 +6,7 @@ try {
6
6
  console.log('No extra Maglev Pro Tailwindcss config');
7
7
  }
8
8
 
9
- module.exports = {
9
+ export default {
10
10
  content: [
11
11
  './**/*.html.erb',
12
12
  './app/helpers/**/*.rb',
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maglevcms
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.3
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Didier Lafforgue
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-17 00:00:00.000000000 Z
11
+ date: 2024-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jbuilder
@@ -58,7 +58,7 @@ dependencies:
58
58
  requirements:
59
59
  - - "<"
60
60
  - !ruby/object:Gem::Version
61
- version: '7.3'
61
+ version: '9'
62
62
  - - ">="
63
63
  - !ruby/object:Gem::Version
64
64
  version: '6'
@@ -68,7 +68,7 @@ dependencies:
68
68
  requirements:
69
69
  - - "<"
70
70
  - !ruby/object:Gem::Version
71
- version: '7.3'
71
+ version: '9'
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
74
  version: '6'
@@ -112,14 +112,14 @@ dependencies:
112
112
  requirements:
113
113
  - - "~>"
114
114
  - !ruby/object:Gem::Version
115
- version: 1.5.6
115
+ version: 1.5.9
116
116
  type: :development
117
117
  prerelease: false
118
118
  version_requirements: !ruby/object:Gem::Requirement
119
119
  requirements:
120
120
  - - "~>"
121
121
  - !ruby/object:Gem::Version
122
- version: 1.5.6
122
+ version: 1.5.9
123
123
  description: " MaglevCMS integrates a powerful website/page builder with a polished
124
124
  UX/UI into your Ruby on Rails application, backed by a flexible and robust CMS engine.\n"
125
125
  email:
@@ -150,6 +150,7 @@ files:
150
150
  - app/components/maglev/content/select.rb
151
151
  - app/components/maglev/content/text.rb
152
152
  - app/components/maglev/content/void.rb
153
+ - app/components/maglev/inspector.rb
153
154
  - app/components/maglev/page_component.rb
154
155
  - app/components/maglev/section_component.rb
155
156
  - app/components/maglev/tag_helper.rb
@@ -208,6 +209,7 @@ files:
208
209
  - app/frontend/editor/assets/remixicons/format-list-unordered.svg
209
210
  - app/frontend/editor/assets/remixicons/format-paragraph.svg
210
211
  - app/frontend/editor/assets/remixicons/format-strikethrough.svg
212
+ - app/frontend/editor/assets/remixicons/format-superscript.svg
211
213
  - app/frontend/editor/assets/remixicons/format-underline.svg
212
214
  - app/frontend/editor/assets/remixicons/home-4-line.svg
213
215
  - app/frontend/editor/assets/remixicons/image-line.svg
@@ -290,6 +292,7 @@ files:
290
292
  - app/frontend/editor/components/kit/rich-text-input/extensions/Doc.js
291
293
  - app/frontend/editor/components/kit/rich-text-input/extensions/LineBreak.js
292
294
  - app/frontend/editor/components/kit/rich-text-input/extensions/marks/Link.js
295
+ - app/frontend/editor/components/kit/rich-text-input/extensions/marks/Superscript.js
293
296
  - app/frontend/editor/components/kit/rich-text-input/format-buttons.vue
294
297
  - app/frontend/editor/components/kit/rich-text-input/link-buttons.vue
295
298
  - app/frontend/editor/components/kit/rich-text-input/list-buttons.vue
@@ -362,6 +365,7 @@ files:
362
365
  - app/frontend/editor/plugins/filters.js
363
366
  - app/frontend/editor/plugins/i18n.js
364
367
  - app/frontend/editor/plugins/index.js
368
+ - app/frontend/editor/plugins/maglev_dummy.js
365
369
  - app/frontend/editor/plugins/tooltip.js
366
370
  - app/frontend/editor/router/index.js
367
371
  - app/frontend/editor/router/routes/base.js
@@ -576,7 +580,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
576
580
  requirements:
577
581
  - - ">="
578
582
  - !ruby/object:Gem::Version
579
- version: '2.6'
583
+ version: '3.0'
580
584
  required_rubygems_version: !ruby/object:Gem::Requirement
581
585
  requirements:
582
586
  - - ">="