is-red
to the h1 Tag (<h1 class="is-red">My H1 Red Title</h1>
)ysmarteditmodule
Template.abAnalytics
.ysmarteditmodule
Template.smartedittrail
smartedittrailcommons
smartedittrailContainer
smartedittrail
is to define Decorators.smartedittrailcommons
is for providing common Services, etc and the smartedittrailContainer
is to provide Containers like the Rich Text Editor is one.smartedit/web/app/common/components/genericEditor/richText
SE_RICH_TEXT_CONFIGURATION_CONSTANT
which is defined as a SeValueProvider
and added to the list of Providers via @SeModule
./* @internal */
export const SE_RICH_TEXT_CONFIGURATION_CONSTANT: SeValueProvider = {
provide: 'seRichTextConfiguration',
useValue: {
toolbar: 'full',
toolbar_full: [
{
name: 'basicstyles',
items: ['Bold', 'Italic', 'Strike', 'Underline']
}, {
name: 'paragraph',
items: ['BulletedList', 'NumberedList', 'Blockquote']
}, {
name: 'editing',
items: ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock']
}, {
name: 'links',
items: ['Link', 'Unlink', 'Anchor']
}, {
name: 'tools',
items: ['SpellChecker', 'Maximize']
},
'/',
{
name: 'styles',
items: ['Format', 'FontSize', 'TextColor', 'PasteText', 'PasteFromWord', 'RemoveFormat']
}, {
name: 'insert',
items: ['Image', 'Table', 'SpecialChar']
}, {
name: 'forms',
items: ['Outdent', 'Indent']
}, {
name: 'clipboard',
items: ['Undo', 'Redo']
}, {
name: 'document',
items: ['PageBreak', 'Source']
}
],
disableNativeSpellChecker: false,
height: '100px',
width: '100%',
autoParagraph: false,
enterMode: CKEDITOR.ENTER_BR,
shiftEnterMode: CKEDITOR.ENTER_BR,
basicEntities: false,
allowedContent: true,
fillEmptyBlocks: false,
extraPlugins: 'colorbutton, colordialog'
}
};
...
@SeModule({
imports: [
'ngSanitize',
'smarteditServicesModule'
],
providers: [
SE_RICH_TEXT_CONFIGURATION_CONSTANT,
...
],
...
})
export class SeRichTextFieldModule {}
SeModule
i could find the line where the Configuration is applied as constant.function addProviderToModule(module: angular.IModule, provider: SeProvider) {
if ((provider as SeValueProvider).useValue) {
provider = provider as SeValueProvider;
module.constant(provider.provide, provider.useValue);
}
...
}
smartedittrail/web/features/smartedittrailContainer/
.richText
and in this folder, we created a new JavaScript File smartedittrailRichText.js
to define a new angular module:angular.module('smartedittrailRichTextModule', ['seRichTextFieldModule', 'ngSanitize',
'smarteditServicesModule'
])
web/features/smartedittrailContainer/smartedittrailcontainerModule.ts
as import:@SeModule({
imports: [
...
'smartedittrailRichTextModule'
]
...
})
export class SmartedittrailContainer {
}
var smartedittrailRichTextConfig = {
name: 'seRichTextConfiguration',
useValue: {
toolbar: 'smartedittrailCustom',
toolbar_smartedittrailCustom: [{
name: 'basicstyles',
items: ['Bold', 'Italic', 'Strike', 'Underline']
}, {
name: 'paragraph',
items: ['BulletedList', 'NumberedList', 'Blockquote']
}, {
name: 'editing',
items: ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock']
}, {
name: 'links',
items: ['Link', 'Unlink', 'Anchor']
}, {
name: 'tools',
items: ['SpellChecker', 'Maximize']
},
'/',
{
name: 'styles',
items: ['Format', 'FontSize', 'TextColor', 'PasteText', 'PasteFromWord',
'RemoveFormat'
]
}, {
name: 'insert',
items: ['Image', 'Table', 'SpecialChar']
}, {
name: 'forms',
items: ['Outdent', 'Indent']
}, {
name: 'clipboard',
items: ['Undo', 'Redo']
}, {
name: 'document',
items: ['PageBreak', 'Source']
}
],
disableNativeSpellChecker: false,
height: '100px',
width: '100%',
autoParagraph: false,
enterMode: CKEDITOR.ENTER_BR,
shiftEnterMode: CKEDITOR.ENTER_BR,
basicEntities: false,
allowedContent: true,
fillEmptyBlocks: false,
format_h1red: {
name: 'H1 red',
element: 'h1',
attributes: {
'class': 'is-red'
}
},
format_tags: 'p;h1red;h1;h2;h3;h4;pre',
contentsCss: '/smartedittrail/css/editor/smartedittrailCKEditorContent.css',
extraPlugins: 'colorbutton, colordialog'
}
};
angular.module('smartedittrailRichTextModule', ['seRichTextFieldModule', 'ngSanitize',
'smarteditServicesModule'
]).constant(smartedittrailRichTextConfig.name,
smartedittrailRichTextConfig.useValue);
smartedittrailRichTextConfig.name
is the same as the standard (see above).smartedittrailRichTextConfig.useValue
. The applied Structure here is compliant with the config options of CKEDITOR. format_h1red: {
name: 'H1 red',
element: 'h1',
attributes: {
'class': 'is-red'
}
},
format_tags: 'p;h1red;h1;h2;h3;h4;pre',
format_h1red
we defined a new style which is added to the list of styles with format_tags
.The new Style is defined with the element: 'h1'
and the class is-red
. We also needed a name for displaying in SmartEdit name: 'H1 red'
.H1 red
to the list of available styles and can be applied. In the Text Source something like this will be added :<h1 class="is-red">My H1 red Title</h1>
is-red
is only known by the Storefront but not by the Editor the Name of the Style, as well as the applied Style will be displayed as Black Text in the Editor.smarteittrail/web/css/editor
with the name smartedittrailCKEditorContent.css
where we defined the style.contentCSs: '/smartedittrail/css/editor/smartedittrailCKEditorContent.css'
format_h1red: {
name: 'H1 red',
element: 'h1',
attributes: {
'class': 'is-red'
}
},
format_tags: 'p;h1red;h1;h2;h3;h4;pre',
contentsCss: '/smartedittrail/css/editor/smartedittrailCKEditorContent.css',
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.