trusty-cms 7.0.43 → 7.0.45

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bf029635066daad115b3e46b75fa8846fb74928e3ff78bfb90fac2b8e0043507
4
- data.tar.gz: 24528aea58cd22785bd779b0e1dad29b18d78a3a0f356a6daa0a0b0c17463fc6
3
+ metadata.gz: a8830acaf3a1831bd605a84200434f0a46db566a361ee665f5de5de5d9044503
4
+ data.tar.gz: 3e5916aa4f93bc4146e31434deabc17d9b69f61e2666697c85c768e7e62be5d1
5
5
  SHA512:
6
- metadata.gz: d71bafd88d6a393c2c8c61839a97212c23e07dec07cc348ad0ab0555aaeeb04b69ace7db4325453a8a29ef2033bb719bc72fd5d6ffa5eefa3557beabc67e3ba3
7
- data.tar.gz: b7d2957a929e2f12dbd431e7d9a7fa1e6533cc0813ca27705bf5e3851f24dcbcd48dd5c0c75df4c1de4888d42ae6f9979158faa25e838da827fe4f717056449d
6
+ metadata.gz: 813b2951257943be50acae8fca1b9f4c51d87e1419e9646351b26e26e0ff2e91ca671f0ac8d9604457563dfb706d4cc0ed769ff928e0e22d6c8d9aea761dae3f
7
+ data.tar.gz: 1494b9500c15592298d5362cec96b4c3fcfc4a0ca8394dea97de9edc1ca5988f29e49cc85eae1a09394e3370d5e2cdfdfb3e2767c5c371ea87567470b328d9e3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trusty-cms (7.0.43)
4
+ trusty-cms (7.0.45)
5
5
  RedCloth (= 4.3.3)
6
6
  activestorage-validator
7
7
  acts_as_list (>= 0.9.5, < 1.3.0)
@@ -103072,10 +103072,14 @@ Original error: ${originalError.name}: ${originalError.message}` : "";
103072
103072
 
103073
103073
  // app/javascript/plugins/asset_tags/asset_tag_builder.js
103074
103074
  var AssetTagBuilder = class extends Plugin {
103075
+ static get requires() {
103076
+ return [Widget];
103077
+ }
103075
103078
  init() {
103076
103079
  console.log("AssetTagBuilder plugin initialized");
103077
103080
  this._defineSchema();
103078
103081
  this._defineConverters();
103082
+ this._defineDataNormalization();
103079
103083
  }
103080
103084
  _defineSchema() {
103081
103085
  const schema = this.editor.model.schema;
@@ -103124,7 +103128,7 @@ Original error: ${originalError.name}: ${originalError.message}` : "";
103124
103128
  if (alt) attrs.alt = alt;
103125
103129
  if (height) attrs.height = height;
103126
103130
  if (width) attrs.width = width;
103127
- return writer.createEmptyElement("r:asset:image", attrs);
103131
+ return writer.createContainerElement("r:asset:image", attrs);
103128
103132
  }
103129
103133
  });
103130
103134
  editingDowncast.elementToElement({
@@ -103141,10 +103145,64 @@ Original error: ${originalError.name}: ${originalError.message}` : "";
103141
103145
  if (alt) attrs.alt = alt;
103142
103146
  if (height) attrs.height = height;
103143
103147
  if (width) attrs.width = width;
103144
- return writer.createContainerElement("r:asset:image", attrs);
103148
+ const container = writer.createContainerElement("span", {
103149
+ class: "asset-image-tag",
103150
+ "data-asset-id": id,
103151
+ "data-asset-size": size
103152
+ });
103153
+ const label = writer.createUIElement(
103154
+ "span",
103155
+ { class: "asset-image-tag__label" },
103156
+ function(domDocument) {
103157
+ const domEl = this.toDomElement(domDocument);
103158
+ const parts = [
103159
+ "Asset image",
103160
+ id ? `#${id}` : "",
103161
+ size ? `(${size})` : "",
103162
+ alt ? `\u2014 ${alt}` : "",
103163
+ height ? `height: ${height}` : "",
103164
+ width ? `width: ${width}` : ""
103165
+ ].filter(Boolean);
103166
+ domEl.textContent = parts.join(" ");
103167
+ return domEl;
103168
+ }
103169
+ );
103170
+ writer.insert(writer.createPositionAt(container, 0), label);
103171
+ return toWidget(container, writer, { label: `Asset image ${id ? `#${id}` : ""}` });
103145
103172
  }
103146
103173
  });
103147
103174
  }
103175
+ _defineDataNormalization() {
103176
+ const editor = this.editor;
103177
+ const processor = editor.data.processor;
103178
+ const originalToView = processor.toView.bind(processor);
103179
+ const originalToData = processor.toData.bind(processor);
103180
+ processor.toView = (data) => {
103181
+ let normalized = data;
103182
+ normalized = normalized.replace(
103183
+ /<r:asset:image\b([^>]*?)\/>/gi,
103184
+ "<r:asset:image$1></r:asset:image>"
103185
+ );
103186
+ normalized = normalized.replace(
103187
+ /<r:asset:image\b([^>]*?)>(?!\s*<\/r:asset:image>)/gi,
103188
+ "<r:asset:image$1></r:asset:image>"
103189
+ );
103190
+ return originalToView(normalized);
103191
+ };
103192
+ processor.toData = (viewFragment) => {
103193
+ const html2 = originalToData(viewFragment);
103194
+ return html2.replace(
103195
+ /<r:asset:image\b([^>]*?)>([\s\S]*?)<\/r:asset:image>/gi,
103196
+ (match, attrs, inner) => {
103197
+ const cleanedInner = inner.replace(
103198
+ /^(?:\s|&nbsp;|&#160;)+|(?:\s|&nbsp;|&#160;)+$/g,
103199
+ ""
103200
+ );
103201
+ return `<r:asset:image${attrs} />${cleanedInner}`;
103202
+ }
103203
+ );
103204
+ };
103205
+ }
103148
103206
  };
103149
103207
 
103150
103208
  // app/javascript/plugins/asset_tags/asset_tags.js
@@ -103225,7 +103283,6 @@ Original error: ${originalError.name}: ${originalError.message}` : "";
103225
103283
  "code",
103226
103284
  "removeFormat",
103227
103285
  "|",
103228
- "specialCharacters",
103229
103286
  "horizontalLine",
103230
103287
  "link",
103231
103288
  "bookmark",