Добавление стилей в RTE (CQ5.4)

Я использую 5.4. Я пытаюсь добавить стиль в раскрывающийся список стилей на странице rte. Я следовал инструкциям на http://docs.adobe.com/docs/en/cq/5-4/administering/configuring_rich_text_editor.html. После добавления узла в text/rtePlugins/styles/styles все параметры плагина отключаются. Кнопки (например, жирный шрифт, курсив, подчеркивание и т. д.) больше нельзя нажимать. Хотя я по-прежнему могу выбирать стили из раскрывающихся списков параформатов и стилей, они не меняют внешний вид моего текста. Более того, хотя я могу изменить текст в рте, изменения не отражаются на странице после того, как я нажму ок.

Я прикрепил снимок своей иерархии узлов для диалогового узла. Пожалуйста, дайте мне знать, если я должен включить любую другую информацию.

введите здесь описание изображения

Спасибо!


person formis    schedule 01.07.2014    source источник


Ответы (2)


Всю эту структуру вы создали сами или откуда-то скопировали? Что вам нужно сделать, так это включить некоторые функции для каждого типа (или все, используя *):

Вот пример для узла стилей:

<styles
    jcr:primaryType="nt:unstructured"
    features="*">
    <styles jcr:primaryType="cq:WidgetCollection">
    [...]
    </styles>
</styles>

Это должно быть верно для всех других узлов, но если вы их вообще не копируете, все функции также должны быть снова активны.

Чтобы ваш пользовательский стиль был доступен в RTE, вам также необходимо предоставить файл CSS в текстовом узле со следующим свойством.

externalStyleSheets="[{path_to_your_stylesheet}]"

Я рекомендую создать его только для RTE, используя только те стили, которые вы добавляете в список стилей.

person Thomas    schedule 02.07.2014
comment
Я сам создал структуру. Я включил все функции, используя *. Я также предоставил файл CSS на своем текстовом узле и попытался использовать clientlibs для ссылки на таблицу стилей. Я попытаюсь создать отдельную таблицу стилей для стилей в списке стилей. - person formis; 02.07.2014
comment
Отдельная таблица стилей не помогла. - person formis; 02.07.2014
comment
Не могли бы вы предоставить пакет содержимого с вашим текстовым компонентом и указанным CSS? Может быть, я найду время, чтобы посмотреть поближе, хотя в настоящее время в моем распоряжении только запущенные экземпляры 5.6.1. Но, насколько я помню, никаких изменений относительно RTE не было. - person Thomas; 03.07.2014

Я следовал приведенным здесь инструкциям, и у меня это сработало: http://docs.adobe.com/docs/en/cq/5-4/administering/configuring_rich_text_editor.html#Styles (текст)

В результате диалог выглядел так:

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="cq:Dialog"
externalStyleSheets="[/etc/designs/myDesign/css/my_colors.css]"
height="500"
width="700"
xtype="dialog">
    <items
    jcr:primaryType="nt:unstructured"
    helpPath="en/cq/current/wcm/default_components.html#Text"
    title="Text"
    xtype="tabpanel">
    <items jcr:primaryType="cq:WidgetCollection">
        <tab1
            jcr:primaryType="cq:Widget"
            anchor="100%"
            height="350"
            title="Text"
            xtype="panel">
            <items jcr:primaryType="cq:WidgetCollection">
                <text
                    jcr:primaryType="cq:Widget"
                    allowBlank="false"
                    blankText=""
                    disabled="false"
                    emptyText=""
                    fieldDescription=""
                    fieldLabel=""
                    fieldSubLabel=""
                    grow="false"
                    height="{Long}350"
                    hideLabel="true"
                    hideMode=""
                    inputType=""
                    maxLength=""
                    maxLengthText=""
                    minLength=""
                    minLengthText=""
                    msgTarget=""
                    name="./text"
                    readOnly="false"
                    regex=""
                    regexText=""
                    selectOnFocus="false"
                    validateOnBlur="true"
                    validationDelay=""
                    validationEvent=""
                    validator=""
                    vtype=""
                    vtypeText=""
                    xtype="richtext">
                    <rtePlugins jcr:primaryType="nt:unstructured">
                        <links jcr:primaryType="nt:unstructured">
                            <linkDialogConfig
                                jcr:primaryType="nt:unstructured"
                                height="316">
                                <linkAttributes jcr:primaryType="cq:WidgetCollection">
                                    <linkAdvanced
                                        jcr:primaryType="cq:Widget"
                                        collapsed="true"
                                        collapsible="true"
                                        inputValue="advanced"
                                        name="./linkdialog/cq:adhocLinkTrackingTab"
                                        title="Link tracking"
                                        xtype="dialogfieldset">
                                        <items jcr:primaryType="cq:WidgetCollection">
                                            <enable
                                                jcr:primaryType="nt:unstructured"
                                                attribute="enabletracking"
                                                fieldDescription="override analytics framework settings"
                                                fieldLabel="Custom link tracking"
                                                name="./linkdialog/cq:adhocLinkTrackingEnableTracking"
                                                xtype="checkbox">
                                                <listeners
                                                    jcr:primaryType="nt:unstructured"
                                                    check="function(component){var dlg=component.findParentByType('rtelinkdialog');dlg.enableSCFields(component.checked);}"/>
                                            </enable>
                                            <events
                                                jcr:primaryType="nt:unstructured"
                                                attribute="adhocevents"
                                                fieldDescription="e.g.: event2, event7"
                                                fieldLabel="Include SiteCatalyst events"
                                                name="./linkdialog/cq:adhocLinkTrackingEvents"
                                                xtype="textfield"/>
                                            <evars
                                                jcr:primaryType="nt:unstructured"
                                                attribute="adhocevars"
                                                fieldDescription="e.g.: eVar1: pagedata.url, prop4: 'const'"
                                                fieldLabel="Include SiteCatalyst variables"
                                                name="./linkdialog/cq:adhocLinkTrackingEvars"
                                                xtype="textfield"/>
                                        </items>
                                    </linkAdvanced>
                                </linkAttributes>
                            </linkDialogConfig>
                        </links>
                        <misctools
                            jcr:primaryType="nt:unstructured"
                            features="*"/>
                        <edit
                            jcr:primaryType="nt:unstructured"
                            features="*"/>
                        <findreplace
                            jcr:primaryType="nt:unstructured"
                            features="*"/>
                        <format
                            jcr:primaryType="nt:unstructured"
                            features="*"/>
                        <image
                            jcr:primaryType="nt:unstructured"
                            features="*"/>
                        <keys
                            jcr:primaryType="nt:unstructured"
                            features="*"/>
                        <justify
                            jcr:primaryType="nt:unstructured"
                            features="*"/>
                        <lists
                            jcr:primaryType="nt:unstructured"
                            features="*"/>
                        <paraformat
                            jcr:primaryType="nt:unstructured"
                            features="*"/>
                        <spellcheck
                            jcr:primaryType="nt:unstructured"
                            features="*"/>
                        <styles
                            jcr:primaryType="nt:unstructured"
                            features="*">
                            <styles jcr:primaryType="cq:WidgetCollection">
                                <Aqua
                                    jcr:primaryType="nt:unstructured"
                                    cssName="Aqua"
                                    text="Aqua"/>
                            </styles>
                        </styles>
                        <subsuperscript
                            jcr:primaryType="nt:unstructured"
                            features="*"/>
                        <table
                            jcr:primaryType="nt:unstructured"
                            features="*"/>
                        <undo
                            jcr:primaryType="nt:unstructured"
                            features="*"/>
                    </rtePlugins>
                </text>
                <isRichTextFlag
                    jcr:primaryType="cq:Widget"
                    ignoreData="true"
                    name="./textIsRich"
                    value="true"
                    xtype="hidden"/>
            </items>
        </tab1>
        <tab2
            jcr:primaryType="cq:Widget"
            xtype="componentstyles"/>
    </items>
</items>
</jcr:root>

Единственными элементами, добавленными в исходный диалог, был атрибут «externalStyleSheets» в узле «jcr: root» (вы должны сопоставить его со своей таблицей стилей):

externalStyleSheets="[/etc/designs/myDesign/css/my_colors.css]"

И узел:

    <styles
         jcr:primaryType="nt:unstructured"
         features="*">
         <styles jcr:primaryType="cq:WidgetCollection">
             <Aqua
                jcr:primaryType="nt:unstructured"
                cssName="Aqua"
                text="Aqua"/>
         </styles>
    </styles>

Атрибут «cssName» должен совпадать с именем вашего стиля css (и ему НЕ должен предшествовать символ «.»), атрибут «text» может быть любым, что вы хотите, это будет то, что появится в раскрывающемся списке.

my_colors.css выглядит так:

.Aqua { color: Aqua; }

Надеюсь это поможет,

-- Джоэл.

person Joel Richard Koett    schedule 12.08.2014