magic-editor-x 1.5.0 → 1.5.1

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.
Files changed (25) hide show
  1. package/dist/_chunks/{App-3CjSGQyL.js → App-DImBvISP.js} +59 -59
  2. package/dist/_chunks/{App-CKlB5p92.mjs → App-iNfbV7cz.mjs} +32 -32
  3. package/dist/_chunks/{CustomBlocksPage-CnJxygIw.js → CustomBlocksPage-Cj-0TTUs.js} +12 -12
  4. package/dist/_chunks/{LicensePage-vJxKYZGQ.js → LicensePage-CmvILX9m.js} +43 -43
  5. package/dist/_chunks/{LicensePage-B2STSez2.mjs → LicensePage-gLRoo8WJ.mjs} +38 -38
  6. package/dist/_chunks/{LiveCollaborationPanel-D70o6EGf.js → LiveCollaborationPanel-BFybu8h0.js} +7 -7
  7. package/dist/_chunks/{LiveCollaborationPanel-uLIJs5z_.mjs → LiveCollaborationPanel-CVgl4IyR.mjs} +3 -3
  8. package/dist/_chunks/{Settings-CdGL1OCi.mjs → Settings-ButYcfrm.mjs} +82 -82
  9. package/dist/_chunks/Settings-BzGqgrxD.js +440 -0
  10. package/dist/_chunks/{getTranslation--JcqVOd5.js → getTranslation-BADoesEn.js} +19120 -12315
  11. package/dist/_chunks/{getTranslation-bLklCCaI.mjs → getTranslation-D3h3Z3gU.mjs} +18708 -11903
  12. package/dist/_chunks/index-BXBnwuRw.js +2158 -0
  13. package/dist/_chunks/index-BvEdg518.mjs +2159 -0
  14. package/dist/_chunks/{index-CRALSDLD.js → index-DDFAuQNT.js} +181 -181
  15. package/dist/_chunks/{index-CdFFlQdx.mjs → index-DEi6nwfM.mjs} +33 -33
  16. package/dist/_chunks/{tools-uudZx91W.mjs → tools-BXzd0lx5.mjs} +3 -3
  17. package/dist/_chunks/{tools-BSMn5LLQ.js → tools-Q0uwDS9E.js} +10 -10
  18. package/dist/admin/index.js +1 -1
  19. package/dist/admin/index.mjs +2 -2
  20. package/dist/server/index.js +142 -135
  21. package/dist/server/index.mjs +142 -135
  22. package/package.json +7 -7
  23. package/dist/_chunks/Settings-CwSNO4_t.js +0 -440
  24. package/dist/_chunks/index-CAPc_Y1F.mjs +0 -2551
  25. package/dist/_chunks/index-CPs6WJDY.js +0 -2550
@@ -10730,73 +10730,76 @@ function envFn(key, defaultValue) {
10730
10730
  function getKey(key) {
10731
10731
  return process.env[key] ?? "";
10732
10732
  }
10733
- const utils$9 = {
10734
- int(key, defaultValue) {
10735
- if (!___default.has(process.env, key)) {
10736
- return defaultValue;
10737
- }
10738
- return parseInt(getKey(key), 10);
10739
- },
10740
- float(key, defaultValue) {
10741
- if (!___default.has(process.env, key)) {
10742
- return defaultValue;
10743
- }
10744
- return parseFloat(getKey(key));
10745
- },
10746
- bool(key, defaultValue) {
10747
- if (!___default.has(process.env, key)) {
10748
- return defaultValue;
10749
- }
10750
- return getKey(key) === "true";
10751
- },
10752
- json(key, defaultValue) {
10753
- if (!___default.has(process.env, key)) {
10754
- return defaultValue;
10755
- }
10756
- try {
10757
- return JSON.parse(getKey(key));
10758
- } catch (error2) {
10759
- if (error2 instanceof Error) {
10760
- throw new Error(`Invalid json environment variable ${key}: ${error2.message}`);
10761
- }
10762
- throw error2;
10763
- }
10764
- },
10765
- array(key, defaultValue) {
10766
- if (!___default.has(process.env, key)) {
10767
- return defaultValue;
10768
- }
10769
- let value = getKey(key);
10770
- if (value.startsWith("[") && value.endsWith("]")) {
10771
- value = value.substring(1, value.length - 1);
10772
- }
10773
- return value.split(",").map((v) => {
10774
- return ___default.trim(___default.trim(v, " "), '"');
10775
- });
10776
- },
10777
- date(key, defaultValue) {
10778
- if (!___default.has(process.env, key)) {
10779
- return defaultValue;
10780
- }
10781
- return new Date(getKey(key));
10782
- },
10783
- /**
10784
- * Gets a value from env that matches oneOf provided values
10785
- * @param {string} key
10786
- * @param {string[]} expectedValues
10787
- * @param {string|undefined} defaultValue
10788
- * @returns {string|undefined}
10789
- */
10790
- oneOf(key, expectedValues, defaultValue) {
10791
- if (!expectedValues) {
10792
- throw new Error(`env.oneOf requires expectedValues`);
10793
- }
10794
- if (defaultValue && !expectedValues.includes(defaultValue)) {
10795
- throw new Error(`env.oneOf requires defaultValue to be included in expectedValues`);
10733
+ function int$2(key, defaultValue) {
10734
+ if (!___default.has(process.env, key)) {
10735
+ return defaultValue;
10736
+ }
10737
+ return parseInt(getKey(key), 10);
10738
+ }
10739
+ function float$1(key, defaultValue) {
10740
+ if (!___default.has(process.env, key)) {
10741
+ return defaultValue;
10742
+ }
10743
+ return parseFloat(getKey(key));
10744
+ }
10745
+ function bool$1(key, defaultValue) {
10746
+ if (!___default.has(process.env, key)) {
10747
+ return defaultValue;
10748
+ }
10749
+ return getKey(key) === "true";
10750
+ }
10751
+ function json$1(key, defaultValue) {
10752
+ if (!___default.has(process.env, key)) {
10753
+ return defaultValue;
10754
+ }
10755
+ try {
10756
+ return JSON.parse(getKey(key));
10757
+ } catch (error2) {
10758
+ if (error2 instanceof Error) {
10759
+ throw new Error(`Invalid json environment variable ${key}: ${error2.message}`);
10796
10760
  }
10797
- const rawValue = env(key, defaultValue);
10798
- return expectedValues.includes(rawValue) ? rawValue : defaultValue;
10761
+ throw error2;
10762
+ }
10763
+ }
10764
+ function array$2(key, defaultValue) {
10765
+ if (!___default.has(process.env, key)) {
10766
+ return defaultValue;
10767
+ }
10768
+ let value = getKey(key);
10769
+ if (value.startsWith("[") && value.endsWith("]")) {
10770
+ value = value.substring(1, value.length - 1);
10799
10771
  }
10772
+ return value.split(",").map((v) => {
10773
+ return ___default.trim(___default.trim(v, " "), '"');
10774
+ });
10775
+ }
10776
+ function date$3(key, defaultValue) {
10777
+ if (!___default.has(process.env, key)) {
10778
+ return defaultValue;
10779
+ }
10780
+ return new Date(getKey(key));
10781
+ }
10782
+ function oneOf(key, expectedValues, defaultValue) {
10783
+ if (!expectedValues) {
10784
+ throw new Error(`env.oneOf requires expectedValues`);
10785
+ }
10786
+ if (defaultValue && !expectedValues.includes(defaultValue)) {
10787
+ throw new Error(`env.oneOf requires defaultValue to be included in expectedValues`);
10788
+ }
10789
+ const rawValue = env(key, defaultValue);
10790
+ if (rawValue !== void 0 && expectedValues.includes(rawValue)) {
10791
+ return rawValue;
10792
+ }
10793
+ return defaultValue;
10794
+ }
10795
+ const utils$9 = {
10796
+ int: int$2,
10797
+ float: float$1,
10798
+ bool: bool$1,
10799
+ json: json$1,
10800
+ array: array$2,
10801
+ date: date$3,
10802
+ oneOf
10800
10803
  };
10801
10804
  const env = Object.assign(envFn, utils$9);
10802
10805
  var lodash_min = { exports: {} };
@@ -14803,6 +14806,7 @@ const getNonVisibleAttributes = (model) => {
14803
14806
  return ___default.uniq([
14804
14807
  ID_ATTRIBUTE$4,
14805
14808
  DOC_ID_ATTRIBUTE$4,
14809
+ PUBLISHED_AT_ATTRIBUTE$1,
14806
14810
  ...getTimestamps(model),
14807
14811
  ...nonVisibleAttributes
14808
14812
  ]);
@@ -14877,6 +14881,12 @@ const getComponentAttributes = (schema2) => {
14877
14881
  return acc;
14878
14882
  }, []);
14879
14883
  };
14884
+ const getMediaAttributes = (schema2) => {
14885
+ return ___default.reduce(schema2.attributes, (acc, attr, attrName) => {
14886
+ if (isMediaAttribute(attr)) acc.push(attrName);
14887
+ return acc;
14888
+ }, []);
14889
+ };
14880
14890
  const getScalarAttributes = (schema2) => {
14881
14891
  return ___default.reduce(schema2.attributes, (acc, attr, attrName) => {
14882
14892
  if (isScalarAttribute(attr)) acc.push(attrName);
@@ -14902,6 +14912,7 @@ const contentTypes$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defi
14902
14912
  getContentTypeRoutePrefix,
14903
14913
  getCreatorFields,
14904
14914
  getDoesAttributeRequireValidation,
14915
+ getMediaAttributes,
14905
14916
  getNonVisibleAttributes,
14906
14917
  getNonWritableAttributes,
14907
14918
  getOptions,
@@ -15081,6 +15092,16 @@ const providerFactory = (options = {}) => {
15081
15092
  }
15082
15093
  };
15083
15094
  };
15095
+ const parallelWithOrderedErrors = async (promises) => {
15096
+ const results = await Promise.allSettled(promises);
15097
+ for (let i2 = 0; i2 < results.length; i2 += 1) {
15098
+ const result = results[i2];
15099
+ if (result.status === "rejected") {
15100
+ throw result.reason;
15101
+ }
15102
+ }
15103
+ return results.map((r) => r.value);
15104
+ };
15084
15105
  const traverseEntity = async (visitor2, options, entity) => {
15085
15106
  const { path: path2 = {
15086
15107
  raw: null,
@@ -15181,15 +15202,13 @@ const traverseEntity = async (visitor2, options, entity) => {
15181
15202
  const isMorphRelation = attribute.relation.toLowerCase().startsWith("morph");
15182
15203
  const method = isMorphRelation ? traverseMorphRelationTarget : traverseRelationTarget(getModel(attribute.target));
15183
15204
  if (fp.isArray(value)) {
15184
- const res = new Array(value.length);
15185
- for (let i3 = 0; i3 < value.length; i3 += 1) {
15205
+ copy[key] = await parallelWithOrderedErrors(value.map((item, i3) => {
15186
15206
  const arrayPath = {
15187
15207
  ...newPath,
15188
15208
  rawWithIndices: fp.isNil(newPath.rawWithIndices) ? `${i3}` : `${newPath.rawWithIndices}.${i3}`
15189
15209
  };
15190
- res[i3] = await method(visitor2, arrayPath, value[i3]);
15191
- }
15192
- copy[key] = res;
15210
+ return method(visitor2, arrayPath, item);
15211
+ }));
15193
15212
  } else {
15194
15213
  copy[key] = await method(visitor2, newPath, value);
15195
15214
  }
@@ -15203,15 +15222,13 @@ const traverseEntity = async (visitor2, options, entity) => {
15203
15222
  path: newPath
15204
15223
  };
15205
15224
  if (fp.isArray(value)) {
15206
- const res = new Array(value.length);
15207
- for (let i3 = 0; i3 < value.length; i3 += 1) {
15225
+ copy[key] = await parallelWithOrderedErrors(value.map((item, i3) => {
15208
15226
  const arrayPath = {
15209
15227
  ...newPath,
15210
15228
  rawWithIndices: fp.isNil(newPath.rawWithIndices) ? `${i3}` : `${newPath.rawWithIndices}.${i3}`
15211
15229
  };
15212
- res[i3] = await traverseMediaTarget(visitor2, arrayPath, value[i3]);
15213
- }
15214
- copy[key] = res;
15230
+ return traverseMediaTarget(visitor2, arrayPath, item);
15231
+ }));
15215
15232
  } else {
15216
15233
  copy[key] = await traverseMediaTarget(visitor2, newPath, value);
15217
15234
  }
@@ -15226,15 +15243,13 @@ const traverseEntity = async (visitor2, options, entity) => {
15226
15243
  };
15227
15244
  const targetSchema = getModel(attribute.component);
15228
15245
  if (fp.isArray(value)) {
15229
- const res = new Array(value.length);
15230
- for (let i3 = 0; i3 < value.length; i3 += 1) {
15246
+ copy[key] = await parallelWithOrderedErrors(value.map((item, i3) => {
15231
15247
  const arrayPath = {
15232
15248
  ...newPath,
15233
15249
  rawWithIndices: fp.isNil(newPath.rawWithIndices) ? `${i3}` : `${newPath.rawWithIndices}.${i3}`
15234
15250
  };
15235
- res[i3] = await traverseComponent(visitor2, arrayPath, targetSchema, value[i3]);
15236
- }
15237
- copy[key] = res;
15251
+ return traverseComponent(visitor2, arrayPath, targetSchema, item);
15252
+ }));
15238
15253
  } else {
15239
15254
  copy[key] = await traverseComponent(visitor2, newPath, targetSchema, value);
15240
15255
  }
@@ -15247,15 +15262,13 @@ const traverseEntity = async (visitor2, options, entity) => {
15247
15262
  attribute,
15248
15263
  path: newPath
15249
15264
  };
15250
- const res = new Array(value.length);
15251
- for (let i3 = 0; i3 < value.length; i3 += 1) {
15265
+ copy[key] = await parallelWithOrderedErrors(value.map((item, i3) => {
15252
15266
  const arrayPath = {
15253
15267
  ...newPath,
15254
15268
  rawWithIndices: fp.isNil(newPath.rawWithIndices) ? `${i3}` : `${newPath.rawWithIndices}.${i3}`
15255
15269
  };
15256
- res[i3] = await visitDynamicZoneEntry(visitor2, arrayPath, value[i3]);
15257
- }
15258
- copy[key] = res;
15270
+ return visitDynamicZoneEntry(visitor2, arrayPath, item);
15271
+ }));
15259
15272
  continue;
15260
15273
  }
15261
15274
  }
@@ -16001,6 +16014,23 @@ const generateInstallId = (projectId, installId) => {
16001
16014
  return require$$1__default.default.randomUUID();
16002
16015
  }
16003
16016
  };
16017
+ const createModelCache = (getModelFn) => {
16018
+ const cache = /* @__PURE__ */ new Map();
16019
+ return {
16020
+ getModel(uid) {
16021
+ const cached2 = cache.get(uid);
16022
+ if (cached2) {
16023
+ return cached2;
16024
+ }
16025
+ const model = getModelFn(uid);
16026
+ cache.set(uid, model);
16027
+ return model;
16028
+ },
16029
+ clear() {
16030
+ cache.clear();
16031
+ }
16032
+ };
16033
+ };
16004
16034
  var map$2;
16005
16035
  try {
16006
16036
  map$2 = Map;
@@ -17500,27 +17530,11 @@ Cache.prototype.set = function(key, value) {
17500
17530
  return this._values[key] = value;
17501
17531
  };
17502
17532
  var SPLIT_REGEX = /[^.^\]^[]+|(?=\[\]|\.\.)/g, DIGIT_REGEX = /^\d+$/, LEAD_DIGIT_REGEX = /^\d/, SPEC_CHAR_REGEX = /[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g, CLEAN_QUOTES_REGEX = /^\s*(['"]?)(.*?)(\1)\s*$/, MAX_CACHE_SIZE = 512;
17503
- var pathCache = new Cache(MAX_CACHE_SIZE), setCache = new Cache(MAX_CACHE_SIZE), getCache = new Cache(MAX_CACHE_SIZE);
17533
+ var pathCache = new Cache(MAX_CACHE_SIZE);
17534
+ new Cache(MAX_CACHE_SIZE);
17535
+ var getCache = new Cache(MAX_CACHE_SIZE);
17504
17536
  var propertyExpr = {
17505
- Cache,
17506
17537
  split,
17507
- normalizePath,
17508
- setter: function(path2) {
17509
- var parts = normalizePath(path2);
17510
- return setCache.get(path2) || setCache.set(path2, function setter(obj, value) {
17511
- var index2 = 0;
17512
- var len = parts.length;
17513
- var data = obj;
17514
- while (index2 < len - 1) {
17515
- var part = parts[index2];
17516
- if (part === "__proto__" || part === "constructor" || part === "prototype") {
17517
- return obj;
17518
- }
17519
- data = data[parts[index2++]];
17520
- }
17521
- data[parts[index2]] = value;
17522
- });
17523
- },
17524
17538
  getter: function(path2, safe) {
17525
17539
  var parts = normalizePath(path2);
17526
17540
  return getCache.get(path2) || getCache.set(path2, function getter(data) {
@@ -17532,11 +17546,6 @@ var propertyExpr = {
17532
17546
  return data;
17533
17547
  });
17534
17548
  },
17535
- join: function(segments) {
17536
- return segments.reduce(function(path2, part) {
17537
- return path2 + (isQuoted(part) || DIGIT_REGEX.test(part) ? "[" + part + "]" : (path2 ? "." : "") + part);
17538
- }, "");
17539
- },
17540
17549
  forEach: function(path2, cb, thisArg) {
17541
17550
  forEach(Array.isArray(path2) ? path2 : split(path2), cb, thisArg);
17542
17551
  }
@@ -36710,6 +36719,7 @@ const dist = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty
36710
36719
  augmentSchema,
36711
36720
  contentTypes: contentTypes$1,
36712
36721
  createContentApiRoutesFactory,
36722
+ createModelCache,
36713
36723
  dates,
36714
36724
  env,
36715
36725
  errors: errors$1,
@@ -38220,7 +38230,7 @@ var accessService$1 = ({ strapi: strapi2 }) => {
38220
38230
  try {
38221
38231
  const permissions = await strapi2.documents("plugin::magic-editor-x.collab-permission").findMany({
38222
38232
  filters: {
38223
- user: { id: user.id }
38233
+ user: { documentId: user.documentId }
38224
38234
  }
38225
38235
  });
38226
38236
  logger2.info("[Access Service] Found permissions:", permissions?.length || 0);
@@ -38270,7 +38280,9 @@ var accessService$1 = ({ strapi: strapi2 }) => {
38270
38280
  return { allowed: false, reason: "permission-required", role: null };
38271
38281
  },
38272
38282
  /**
38273
- * Hilfsfunktion: Gibt Rollen-Level zurück (höher = mehr Rechte)
38283
+ * Returns role level (higher = more permissions)
38284
+ * @param {string} role - Role name (viewer, editor, owner)
38285
+ * @returns {number} Role level (1-3)
38274
38286
  */
38275
38287
  getRoleLevel(role) {
38276
38288
  const levels = { viewer: 1, editor: 2, owner: 3 };
@@ -38321,7 +38333,7 @@ var accessService$1 = ({ strapi: strapi2 }) => {
38321
38333
  }
38322
38334
  const permissions = await strapi2.documents("plugin::magic-editor-x.collab-permission").findMany({
38323
38335
  filters: {
38324
- user: { id: userId }
38336
+ user: { documentId: userId }
38325
38337
  }
38326
38338
  });
38327
38339
  if (!permissions || permissions.length === 0) {
@@ -38495,7 +38507,7 @@ var snapshotService$1 = ({ strapi: strapi2 }) => {
38495
38507
  };
38496
38508
  };
38497
38509
  const name = "magic-editor-x";
38498
- const version = "1.4.0";
38510
+ const version = "1.5.0";
38499
38511
  const description = "Advanced block-based editor for Strapi v5 with Editor.js, Media Library integration, and real-time collaboration support";
38500
38512
  const keywords = [
38501
38513
  "strapi",
@@ -38581,24 +38593,24 @@ const devDependencies = {
38581
38593
  "@semantic-release/github": "^11.0.1",
38582
38594
  "@semantic-release/npm": "^12.0.1",
38583
38595
  "@semantic-release/release-notes-generator": "^14.0.1",
38584
- "@strapi/design-system": "^2.0.0-rc.30",
38585
- "@strapi/icons": "^2.0.0-rc.30",
38596
+ "@strapi/design-system": "^2.0.2",
38597
+ "@strapi/icons": "^2.0.2",
38586
38598
  "@strapi/sdk-plugin": "^5.3.2",
38587
- "@strapi/strapi": "^5.31.2",
38599
+ "@strapi/strapi": "^5.36.0",
38588
38600
  prettier: "^3.7.3",
38589
38601
  react: "^18.3.1",
38590
38602
  "react-dom": "^18.3.1",
38591
38603
  "react-router-dom": "^6.30.2",
38592
38604
  "semantic-release": "^25.0.2",
38593
- "styled-components": "^6.1.19"
38605
+ "styled-components": "^6.3.8"
38594
38606
  };
38595
38607
  const peerDependencies = {
38596
38608
  "@strapi/sdk-plugin": "^5.3.2",
38597
- "@strapi/strapi": "^5.31.2",
38609
+ "@strapi/strapi": "^5.36.0",
38598
38610
  react: "^18.3.1",
38599
38611
  "react-dom": "^18.3.1",
38600
38612
  "react-router-dom": "^6.30.2",
38601
- "styled-components": "^6.1.19"
38613
+ "styled-components": "^6.3.8"
38602
38614
  };
38603
38615
  const overrides = {
38604
38616
  prismjs: "^1.30.0"
@@ -39141,27 +39153,22 @@ const { logger } = utils$a;
39141
39153
  const getCustomBlockUID = () => "plugin::magic-editor-x.custom-block";
39142
39154
  var customBlockService$1 = ({ strapi: strapi2 }) => ({
39143
39155
  /**
39144
- * Count blocks by type
39156
+ * Count blocks by type using native count() method
39145
39157
  * @returns {Promise<object>} Block counts by type
39146
39158
  */
39147
39159
  async countBlocks() {
39148
39160
  try {
39149
- const allBlocks = await strapi2.documents(getCustomBlockUID()).findMany({
39150
- filters: {}
39151
- });
39152
- const counts = {
39153
- simple: 0,
39154
- "embedded-entry": 0,
39155
- total: allBlocks.length
39161
+ const [total, embedded] = await Promise.all([
39162
+ strapi2.documents(getCustomBlockUID()).count(),
39163
+ strapi2.documents(getCustomBlockUID()).count({
39164
+ filters: { blockType: "embedded-entry" }
39165
+ })
39166
+ ]);
39167
+ return {
39168
+ simple: total - embedded,
39169
+ "embedded-entry": embedded,
39170
+ total
39156
39171
  };
39157
- allBlocks.forEach((block) => {
39158
- if (block.blockType === "embedded-entry") {
39159
- counts["embedded-entry"]++;
39160
- } else {
39161
- counts.simple++;
39162
- }
39163
- });
39164
- return counts;
39165
39172
  } catch (error2) {
39166
39173
  logger.error("[CustomBlockService] Error counting blocks:", error2);
39167
39174
  throw error2;