trusty-cms 7.0.41 → 7.0.42

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.
@@ -0,0 +1,81 @@
1
+ import { Plugin } from 'ckeditor5';
2
+
3
+ export default class AssetTagBuilder extends Plugin {
4
+ init() {
5
+ console.log( 'AssetTagBuilder plugin initialized' );
6
+ // Plugin logic goes here
7
+ this._defineSchema();
8
+ this._defineConverters();
9
+ }
10
+
11
+ _defineSchema() {
12
+ const schema = this.editor.model.schema;
13
+
14
+ schema.register( 'assetImage', {
15
+ allowWhere: '$text',
16
+ isInline: true,
17
+ isObject: true,
18
+ allowAttributes: [ 'id', 'size', 'alt' ]
19
+ } );
20
+ }
21
+
22
+ _defineConverters() {
23
+ const conversion = this.editor.conversion;
24
+
25
+ const upcast = conversion.for( 'upcast' );
26
+ const dataDowncast = conversion.for( 'dataDowncast' );
27
+ const editingDowncast = conversion.for( 'editingDowncast' );
28
+
29
+ upcast.elementToElement( {
30
+ view: {
31
+ name: 'r:asset:image'
32
+ },
33
+ model: ( viewElement, { writer } ) => {
34
+ const attrs = {};
35
+ const id = viewElement.getAttribute( 'id' );
36
+ const size = viewElement.getAttribute( 'size' );
37
+ const alt = viewElement.getAttribute( 'alt' );
38
+
39
+ if ( id ) attrs.id = id;
40
+ if ( size ) attrs.size = size;
41
+ if ( alt ) attrs.alt = alt;
42
+
43
+ return writer.createElement( 'assetImage', attrs );
44
+ }
45
+ } );
46
+
47
+ // Data downcast: ensure no inner whitespace like   gets serialized.
48
+ dataDowncast.elementToElement( {
49
+ model: 'assetImage',
50
+ view: ( modelElement, { writer } ) => {
51
+ const attrs = {};
52
+ const id = modelElement.getAttribute( 'id' );
53
+ const size = modelElement.getAttribute( 'size' );
54
+ const alt = modelElement.getAttribute( 'alt' );
55
+
56
+ if ( id ) attrs.id = id;
57
+ if ( size ) attrs.size = size;
58
+ if ( alt ) attrs.alt = alt;
59
+
60
+ return writer.createEmptyElement( 'r:asset:image', attrs );
61
+ }
62
+ } );
63
+
64
+ // Editing downcast: keep a container element for proper cursor behavior.
65
+ editingDowncast.elementToElement( {
66
+ model: 'assetImage',
67
+ view: ( modelElement, { writer } ) => {
68
+ const attrs = {};
69
+ const id = modelElement.getAttribute( 'id' );
70
+ const size = modelElement.getAttribute( 'size' );
71
+ const alt = modelElement.getAttribute( 'alt' );
72
+
73
+ if ( id ) attrs.id = id;
74
+ if ( size ) attrs.size = size;
75
+ if ( alt ) attrs.alt = alt;
76
+
77
+ return writer.createContainerElement( 'r:asset:image', attrs );
78
+ }
79
+ } );
80
+ }
81
+ }
@@ -0,0 +1,8 @@
1
+ import AssetTagBuilder from './asset_tag_builder';
2
+ import { Plugin } from 'ckeditor5';
3
+
4
+ export default class AssetTags extends Plugin {
5
+ static get requires() {
6
+ return [ AssetTagBuilder ];
7
+ }
8
+ }
@@ -46,6 +46,8 @@ const defaultStyleDefinitions = [
46
46
  }
47
47
  ]
48
48
 
49
+ import AssetTagBuilder from '../plugins/asset_tags/asset_tags';
50
+
49
51
  import {
50
52
  ClassicEditor,
51
53
  Alignment,
@@ -96,13 +98,6 @@ import {
96
98
  ShowBlocks,
97
99
  SimpleUploadAdapter,
98
100
  SourceEditing,
99
- SpecialCharacters,
100
- SpecialCharactersArrows,
101
- SpecialCharactersCurrency,
102
- SpecialCharactersEssentials,
103
- SpecialCharactersLatin,
104
- SpecialCharactersMathematical,
105
- SpecialCharactersText,
106
101
  Strikethrough,
107
102
  Style,
108
103
  Subscript,
@@ -173,6 +168,7 @@ const editorConfig = {
173
168
  },
174
169
  plugins: [
175
170
  Alignment,
171
+ AssetTagBuilder,
176
172
  Autoformat,
177
173
  AutoImage,
178
174
  AutoLink,
@@ -1,3 +1,3 @@
1
1
  module TrustyCms
2
- VERSION = '7.0.41'.freeze
2
+ VERSION = '7.0.42'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trusty-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.41
4
+ version: 7.0.42
5
5
  platform: ruby
6
6
  authors:
7
7
  - TrustyCms CMS dev team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-10-23 00:00:00.000000000 Z
11
+ date: 2025-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activestorage-validator
@@ -818,6 +818,8 @@ files:
818
818
  - app/helpers/scoped_helper.rb
819
819
  - app/helpers/site_helper.rb
820
820
  - app/helpers/sites_helper.rb
821
+ - app/javascript/plugins/asset_tags/asset_tag_builder.js
822
+ - app/javascript/plugins/asset_tags/asset_tags.js
821
823
  - app/javascript/trusty_cms/ckeditor5.js
822
824
  - app/mailers/application_mailer.rb
823
825
  - app/mailers/devise_mailer.rb