diff --git a/abstract/Block.js b/abstract/Block.js index 80c118d7..d2582859 100644 --- a/abstract/Block.js +++ b/abstract/Block.js @@ -15,6 +15,7 @@ import { sharedConfigKey } from './sharedConfigKey.js'; import { A11y } from './a11y.js'; const TAG_PREFIX = 'uc-'; +const LEGACY_TAG_PREFIX = 'lr-'; // @ts-ignore TODO: fix this export class Block extends BaseComponent { @@ -326,13 +327,22 @@ export class Block extends BaseComponent { console.log(`[${this.ctxName}]`, ...consoleArgs); } - /** @param {String} [name] */ - static reg(name) { + /** + * @param {String} [name] + * @param {Boolean} [isAlias] + */ + static reg(name, isAlias = false) { if (!name) { super.reg(); return; } - super.reg(name.startsWith(TAG_PREFIX) ? name : TAG_PREFIX + name); + if (name.startsWith(TAG_PREFIX)) { + super.reg(name.startsWith(TAG_PREFIX) ? name : TAG_PREFIX + name, isAlias); + } + + if (name.startsWith(LEGACY_TAG_PREFIX)) { + super.reg(name.startsWith(LEGACY_TAG_PREFIX) ? name : LEGACY_TAG_PREFIX + name, isAlias); + } } } diff --git a/abstract/registerBlocks.js b/abstract/registerBlocks.js index 06611fbe..7cc25540 100644 --- a/abstract/registerBlocks.js +++ b/abstract/registerBlocks.js @@ -10,11 +10,22 @@ export function registerBlocks(blockExports) { if (tagName.startsWith('-')) { tagName = tagName.replace('-', ''); } + + let currentTagName = ''; if (!tagName.startsWith('uc-')) { - tagName = 'uc-' + tagName; + currentTagName = addPrefix('uc-', tagName); } + + let legacyTagName = ''; + if (!tagName.startsWith('lr-')) { + legacyTagName = addPrefix('lr-', tagName); + } + if (blockExports[blockName].reg) { - blockExports[blockName].reg(tagName); + blockExports[blockName].reg(currentTagName); + blockExports[blockName].reg(legacyTagName, true); } } } + +const addPrefix = (prefix, name) => prefix + name; diff --git a/build-items.js b/build-items.js index 50f91ffa..a186c83d 100644 --- a/build-items.js +++ b/build-items.js @@ -82,4 +82,71 @@ export const buildItems = [ minify: true, minifyHtml: true, }, + + // @TODO eadidenko, Delete after a few releases + // Legacy + { + in: './blocks/themes/uc-basic/index.css', + out: './web/lr-basic.min.css', + minify: true, + }, + // uc-cloud-image-editor + { + in: './solutions/cloud-image-editor/index.js', + out: './web/lr-cloud-image-editor.min.js', + minify: true, + minifyHtml: true, + }, + { + in: './solutions/cloud-image-editor/index.css', + out: './web/lr-cloud-image-editor.min.css', + minify: true, + }, + + // file-uploader-regular + { + in: './solutions/file-uploader/regular/index.js', + out: './web/lr-file-uploader-regular.min.js', + minify: true, + minifyHtml: true, + }, + { + in: './solutions/file-uploader/regular/index.css', + out: './web/lr-file-uploader-regular.min.css', + minify: true, + }, + + // file-uploader-inline + { + in: './solutions/file-uploader/inline/index.js', + out: './web/lr-file-uploader-inline.min.js', + minify: true, + minifyHtml: true, + }, + { + in: './solutions/file-uploader/inline/index.css', + out: './web/lr-file-uploader-inline.min.css', + minify: true, + }, + + // file-uploader-minimal + { + in: './solutions/file-uploader/minimal/index.js', + out: './web/lr-file-uploader-minimal.min.js', + minify: true, + minifyHtml: true, + }, + { + in: './solutions/file-uploader/minimal/index.css', + out: './web/lr-file-uploader-minimal.min.css', + minify: true, + }, + + // uc-img + { + in: './solutions/adaptive-image/index.js', + out: './web/lr-img.min.js', + minify: true, + minifyHtml: true, + }, ];