Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-1689: Change all ez- classes/IDs and eZ variables in frontend part #8

Merged
merged 3 commits into from
Dec 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/bundle/Resources/encore/ez.webpack.custom.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ Encore.setOutputPath('public/assets/richtext/build')
.enableSassLoader()
.disableSingleRuntimeChunk();

Encore.addEntry('ezplatform-richtext-onlineeditor-js', [
Encore.addEntry('ibexa-richtext-onlineeditor-js', [
path.resolve(__dirname, '../public/js/CKEditor/core/base-ckeditor.js'),
]).addStyleEntry('ezplatform-richtext-onlineeditor-css', [path.resolve(__dirname, '../public/scss/ckeditor.scss')]);
]).addStyleEntry('ibexa-richtext-onlineeditor-css', [path.resolve(__dirname, '../public/scss/ckeditor.scss')]);

Encore.addAliases({
'@ckeditor': path.resolve(__dirname, '../../../../../../ibexa/admin-ui-assets/src/bundle/Resources/public/vendors/@ckeditor'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class IbexaAnchorUI extends Plugin {

buttonView.set({
label: Translator.trans(/*@Desc("Anchor")*/ 'anchor_btn.label', {}, 'ck_editor'),
icon: window.eZ.helpers.icon.getIconPath('link-anchor'),
icon: window.ibexa.helpers.icon.getIconPath('link-anchor'),
tooltip: true,
});

Expand Down
10 changes: 5 additions & 5 deletions src/bundle/Resources/public/js/CKEditor/core/base-ckeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import ContextualBalloon from '@ckeditor/ckeditor5-ui/src/panel/balloon/contextu

const VIEWPORT_TOP_OFFSET = 102;

(function(global, doc, eZ) {
(function(global, doc, ibexa) {
class BaseRichText {
constructor(config) {
this.ezNamespace = 'http://ez.no/namespaces/ezpublish5/xhtml5/edit';
Expand Down Expand Up @@ -117,8 +117,8 @@ const VIEWPORT_TOP_OFFSET = 102;
init(container) {
const wrapper = this.getHTMLDocumentFragment(container.closest('.ibexa-data-source').querySelector('textarea').value);
const section = wrapper.childNodes[0];
const { toolbar, extraPlugins = [] } = window.eZ.richText.CKEditor;
const blockCustomStyles = Object.entries(eZ.richText.customStyles)
const { toolbar, extraPlugins = [] } = window.ibexa.richText.CKEditor;
const blockCustomStyles = Object.entries(ibexa.richText.customStyles)
.filter(([customStyleName, customStyleConfig]) => !customStyleConfig.inline)
.map(([customStyleName, customStyleConfig]) => {
return {
Expand Down Expand Up @@ -206,5 +206,5 @@ const VIEWPORT_TOP_OFFSET = 102;
}
}

eZ.BaseRichText = BaseRichText;
})(window, window.document, window.eZ);
ibexa.BaseRichText = BaseRichText;
})(window, window.document, window.ibexa);
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class IbexaCustomAttributesCommand extends Command {
refresh() {
const parentElement = this.editor.model.document.selection.getFirstPosition().parent;
const isEnabled =
window.eZ.richText.alloyEditor.attributes[parentElement.name] || window.eZ.richText.alloyEditor.classes[parentElement.name];
window.ibexa.richText.alloyEditor.attributes[parentElement.name] || window.ibexa.richText.alloyEditor.classes[parentElement.name];

this.isEnabled = !!isEnabled;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class IbexaCustomAttributesEditing extends Plugin {
},
});

Object.values(window.eZ.richText.alloyEditor.attributes).forEach((customAttributes) => {
Object.values(window.ibexa.richText.alloyEditor.attributes).forEach((customAttributes) => {
Object.keys(customAttributes).forEach((customAttributeName) => {
conversion.attributeToAttribute({
model: {
Expand All @@ -36,11 +36,11 @@ class IbexaCustomAttributesEditing extends Plugin {

init() {
const { model } = this.editor;
const elementsWithCustomAttributes = Object.keys(window.eZ.richText.alloyEditor.attributes);
const elementsWithCustomClasses = Object.keys(window.eZ.richText.alloyEditor.classes);
const elementsWithCustomAttributes = Object.keys(window.ibexa.richText.alloyEditor.attributes);
const elementsWithCustomClasses = Object.keys(window.ibexa.richText.alloyEditor.classes);

elementsWithCustomAttributes.forEach((element) => {
const customAttributes = Object.keys(window.eZ.richText.alloyEditor.attributes[element]);
const customAttributes = Object.keys(window.ibexa.richText.alloyEditor.attributes[element]);

model.schema.extend(element, { allowAttributes: customAttributes });
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class IbexaAttributesUI extends Plugin {

showForm() {
const parentElement = this.getModelElement();
const customAttributes = window.eZ.richText.alloyEditor.attributes[parentElement.name];
const customClasses = window.eZ.richText.alloyEditor.classes[parentElement.name];
const customAttributes = window.ibexa.richText.alloyEditor.attributes[parentElement.name];
const customClasses = window.ibexa.richText.alloyEditor.classes[parentElement.name];
const areCustomAttributesSet =
parentElement.hasAttribute('custom-classes') ||
Object.keys(customAttributes).some((customAttributeName) => parentElement.hasAttribute(customAttributeName));
Expand Down Expand Up @@ -99,7 +99,7 @@ class IbexaAttributesUI extends Plugin {

buttonView.set({
label: Translator.trans(/*@Desc("Custom attributes")*/ 'custom_attributes_btn.label', {}, 'ck_editor'),
icon: window.eZ.helpers.icon.getIconPath('edit'),
icon: window.ibexa.helpers.icon.getIconPath('edit'),
tooltip: true,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class IbexaCustomStyleInlineUI extends Plugin {
init() {
this.editor.ui.componentFactory.add('ibexaCustomStyleInline', (locale) => {
const dropdownView = createDropdown(locale);
const customStylesInline = Object.entries(window.eZ.richText.customStyles).filter(([name, config]) => config.inline);
const customStylesInline = Object.entries(window.ibexa.richText.customStyles).filter(([name, config]) => config.inline);
const customStylesButtons = customStylesInline.map(this.createButton);

dropdownView.buttonView.set({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import IbexaCustomStylesInlineEditing from './custom-style-inline-editing';

class IbexaCustomStylesInline extends Plugin {
static get requires() {
const customStylesInline = Object.entries(window.eZ.richText.customStyles).filter(([name, config]) => config.inline);
const customStylesInline = Object.entries(window.ibexa.richText.customStyles).filter(([name, config]) => config.inline);
const customStylesInlineEditing = customStylesInline.map(([name, config]) => {
return class CustomStyleEditing extends IbexaCustomStylesInlineEditing {
constructor(props) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ class IbexaCustomTagEditing extends Plugin {
const domElement = this.toDomElement(domDocument);

domElement.innerHTML = `
<div class="ibexa-custom-tag__header-title">${window.eZ.richText.customTags[customTagName].label}</div>
<div class="ibexa-custom-tag__header-title">${window.ibexa.richText.customTags[customTagName].label}</div>
<div class="ibexa-custom-tag__header-actions">
<button type="button" class="ibexa-btn ibexa-btn--ghost ibexa-btn--small ibexa-btn--no-text ibexa-btn--show-custom-tag-attributes">
<svg class="ibexa-icon ibexa-icon--small ibexa-icon--secondary">
<use xlink:href="${window.eZ.helpers.icon.getIconPath('settings-block')}"></use>
<use xlink:href="${window.ibexa.helpers.icon.getIconPath('settings-block')}"></use>
</svg>
</button>
<button type="button" class="ibexa-btn ibexa-btn--ghost ibexa-btn--small ibexa-btn--no-text ibexa-btn--remove-custom-tag">
<svg class="ibexa-icon ibexa-icon--small ibexa-icon--secondary">
<use xlink:href="${window.eZ.helpers.icon.getIconPath('trash')}"></use>
<use xlink:href="${window.ibexa.helpers.icon.getIconPath('trash')}"></use>
</svg>
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class IbexaCustomTagUI extends Plugin {
const modelElement = this.editor.model.document.selection.getSelectedElement();
const values = modelElement.getAttribute('values');

this.attributesView.setValues(values, window.eZ.richText.customTags[this.componentName].label);
this.attributesView.setValues(values, window.ibexa.richText.customTags[this.componentName].label);

this.balloon.add({
view: this.attributesView,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import IbexaInlineCustomTagsEditing from './inline-custom-tag/inline-custom-tag-

class IbexaCustomTags extends Plugin {
static get requires() {
const blockCustomTags = Object.entries(window.eZ.richText.customTags).filter(([name, config]) => !config.isInline);
const inlineCustomTags = Object.entries(window.eZ.richText.customTags).filter(([name, config]) => config.isInline);
const blockCustomTags = Object.entries(window.ibexa.richText.customTags).filter(([name, config]) => !config.isInline);
const inlineCustomTags = Object.entries(window.ibexa.richText.customTags).filter(([name, config]) => config.isInline);
const inlineCustomTagsUI = inlineCustomTags.map(([name, config]) => {
return class InlineCustomTagUI extends IbexaInlineCustomTagsUI {
constructor(props) {
Expand All @@ -21,7 +21,7 @@ class IbexaCustomTags extends Plugin {
{
attributes: this.config.attributes,
},
window.eZ.richText.customTags[name].label
window.ibexa.richText.customTags[name].label
);
}
};
Expand All @@ -38,7 +38,7 @@ class IbexaCustomTags extends Plugin {
{
attributes: this.config.attributes,
},
window.eZ.richText.customTags[name].label
window.ibexa.richText.customTags[name].label
);

this.attributesView.setChildren({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class IbexaCustomTagFormView extends View {
const buttonView = new IbexaButtonView(this.locale);

buttonView.set({
icon: window.eZ.helpers.icon.getIconPath('edit'),
icon: window.ibexa.helpers.icon.getIconPath('edit'),
});

buttonView.delegate('execute').to(this, 'edit-attributes');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { findContent } from '../../services/content-service';

const renderPreview = (title) => {
return `<svg class="ibexa-icon ibexa-icon--medium ibexa-icon--secondary">
<use xlink:href="${window.eZ.helpers.icon.getIconPath('embed')}"></use>
<use xlink:href="${window.ibexa.helpers.icon.getIconPath('embed')}"></use>
</svg>
<span class="ibexa-embed-content__title">${title}</span>`;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class IbexaEmbedContentInlineUI extends IbexaEmbedBaseUI {
this.commandName = 'insertIbexaEmbedInline';
this.buttonLabel = Translator.trans(/*@Desc("Embed")*/ 'embed_btn.label', {}, 'ck_editor');
this.componentName = 'ibexaEmbedInline';
this.icon = window.eZ.helpers.icon.getIconPath('embed');
this.icon = window.ibexa.helpers.icon.getIconPath('embed');
}

getCommandOptions(items) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { findContent } from '../../services/content-service';

const renderPreview = (title) => {
return `<svg class="ibexa-icon ibexa-icon--medium ibexa-icon--secondary">
<use xlink:href="${window.eZ.helpers.icon.getIconPath('embed')}"></use>
<use xlink:href="${window.ibexa.helpers.icon.getIconPath('embed')}"></use>
</svg>
<span class="ibexa-embed-content__title">${title}</span>`;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class IbexaEmbedContentUI extends IbexaEmbedBaseUI {
this.commandName = 'insertIbexaEmbed';
this.buttonLabel = Translator.trans(/*@Desc("Embed")*/ 'embed_btn.label', {}, 'ck_editor');
this.componentName = 'ibexaEmbed';
this.icon = window.eZ.helpers.icon.getIconPath('embed');
this.icon = window.ibexa.helpers.icon.getIconPath('embed');
}

getCommandOptions(items) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class IbexaEmbedBaseUI extends Plugin {
chooseContent() {
const languageCode = document.querySelector('meta[name="LanguageCode"]').content;
const config = JSON.parse(document.querySelector(`[data-udw-config-name="${this.configName}"]`).dataset.udwConfig);
const selectContent = window.eZ.richText.alloyEditor.callbacks.selectContent;
const selectContent = window.ibexa.richText.alloyEditor.callbacks.selectContent;
const mergedConfig = Object.assign(
{
onConfirm: this.confirmHandler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class IbexaEmbedImageEditing extends Plugin {
writer.setAttribute('previewUrl', imageData.ContentImageVariation.uri, modelElement);
});
})
.catch(window.eZ.helpers.notification.showErrorNotification);
.catch(window.ibexa.helpers.notification.showErrorNotification);
}

defineSchema() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class IbexaEmbedImageUI extends IbexaEmbedBaseUI {
this.commandName = 'insertIbexaEmbedImage';
this.buttonLabel = Translator.trans(/*@Desc("Image")*/ 'image_btn.label', {}, 'ck_editor');
this.componentName = 'ibexaEmbedImage';
this.icon = window.eZ.helpers.icon.getIconPath('image');
this.icon = window.ibexa.helpers.icon.getIconPath('image');
}

getCommandOptions(items) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class IbexaEmbedImageVariationsUI extends Plugin {
const dropdownView = createDropdown(locale);
const itemDefinitions = new Collection();

Object.keys(window.eZ.adminUiConfig.imageVariations).forEach((variation) => {
Object.keys(window.ibexa.adminUiConfig.imageVariations).forEach((variation) => {
itemDefinitions.add({
type: 'button',
model: new Model({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class IbexaFormattedUI extends Plugin {

buttonView.set({
label: Translator.trans(/*@Desc("Formatted")*/ 'formatted_btn.label', {}, 'ck_editor'),
icon: window.eZ.helpers.icon.getIconPath('tag'),
icon: window.ibexa.helpers.icon.getIconPath('tag'),
tooltip: true,
});

Expand Down
2 changes: 1 addition & 1 deletion src/bundle/Resources/public/js/CKEditor/link/link-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class IbexaLinkUI extends Plugin {

buttonView.set({
label: Translator.trans(/*@Desc("Link")*/ 'link_btn.label', {}, 'ck_editor'),
icon: window.eZ.helpers.icon.getIconPath('link'),
icon: window.ibexa.helpers.icon.getIconPath('link'),
tooltip: true,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class IbexaLinkFormView extends View {
chooseContent() {
const languageCode = document.querySelector('meta[name="LanguageCode"]').content;
const config = JSON.parse(document.querySelector(`[data-udw-config-name="richtext_embed"]`).dataset.udwConfig);
const selectContent = window.eZ.richText.alloyEditor.callbacks.selectContent;
const selectContent = window.ibexa.richText.alloyEditor.callbacks.selectContent;
const mergedConfig = Object.assign(
{
onConfirm: this.confirmHandler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class IbexaMoveDownUI extends Plugin {

buttonView.set({
label: Translator.trans(/*@Desc("Move down")*/ 'move_down_btn.title', {}, 'ck_editor'),
icon: window.eZ.helpers.icon.getIconPath('circle-caret-down'),
icon: window.ibexa.helpers.icon.getIconPath('circle-caret-down'),
tooltip: true,
});

Expand Down
2 changes: 1 addition & 1 deletion src/bundle/Resources/public/js/CKEditor/move/move-up-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class IbexaMoveUpUI extends Plugin {

buttonView.set({
label: Translator.trans(/*@Desc("Move up")*/ 'move_up_btn.title', {}, 'ck_editor'),
icon: window.eZ.helpers.icon.getIconPath('circle-caret-up'),
icon: window.ibexa.helpers.icon.getIconPath('circle-caret-up'),
tooltip: true,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class IbexaRemoveElementUI extends Plugin {

buttonView.set({
label: Translator.trans(/*@Desc("Remove")*/ 'remove_block.title', {}, 'ck_editor'),
icon: window.eZ.helpers.icon.getIconPath('trash'),
icon: window.ibexa.helpers.icon.getIconPath('trash'),
tooltip: true,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ export const findContent = ({ token, siteaccess, contentId, limit = 1, offset =
});

fetch(request)
.then(window.eZ.helpers.request.getJsonFromResponse)
.then(window.ibexa.helpers.request.getJsonFromResponse)
.then((response) => {
const items = response.View.Result.searchHits.searchHit.map((searchHit) => searchHit.value.Content);

callback(items);
})
.catch(window.eZ.helpers.notification.showErrorNotification);
.catch(window.ibexa.helpers.notification.showErrorNotification);
};
4 changes: 2 additions & 2 deletions src/bundle/Resources/public/scss/_general.scss
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@
vertical-align: middle;
font-size: calculateRem(16px);

.ez-embed-content {
.ez-icon {
.ibexa-embed-content {
.ibexa-icon {
width: calculateRem(22px);
height: calculateRem(22px);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/RichText/Converter/AggregateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function providerConvertWithLinkInCustomTag(): array
xmlns:ezcustom="http://ez.no/xmlns/ezpublish/docbook/custom"
version="5.0-variant ezpublish-1.0">
<para></para>
<eztemplate name="bulbo" ezxhtml:class="ez-custom-tag ez-custom-tag--attributes-visible">
<eztemplate name="bulbo" ezxhtml:class="ibexa-custom-tag ibexa-custom-tag--attributes-visible">
<ezcontent>
<para>Just a regular text</para>
<para>
Expand All @@ -81,7 +81,7 @@ public function providerConvertWithLinkInCustomTag(): array
</section>',
'<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ezxhtml="http://ez.no/xmlns/ezpublish/docbook/xhtml" xmlns:ezcustom="http://ez.no/xmlns/ezpublish/docbook/custom" version="5.0-variant ezpublish-1.0">
<para/>
<eztemplate name="bulbo" ezxhtml:class="ez-custom-tag ez-custom-tag--attributes-visible">
<eztemplate name="bulbo" ezxhtml:class="ibexa-custom-tag ibexa-custom-tag--attributes-visible">
<ezcontent>
<para>Just a regular text</para>
<para>
Expand Down