Proyectos de Subversion Moodle

Rev

Rev 11 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 11 Rev 1441
Línea 33... Línea 33...
33
    create() {
33
    create() {
34
        // Optional component name for debugging.
34
        // Optional component name for debugging.
35
        this.name = 'format_topics_section';
35
        this.name = 'format_topics_section';
36
        // Default query selectors.
36
        // Default query selectors.
37
        this.selectors = {
37
        this.selectors = {
38
            SECTION: `[data-for='section']`,
-
 
39
            SETMARKER: `[data-action="sectionHighlight"]`,
38
            SETMARKER: `[data-action="sectionHighlight"]`,
40
            REMOVEMARKER: `[data-action="sectionUnhighlight"]`,
39
            REMOVEMARKER: `[data-action="sectionUnhighlight"]`,
41
            ACTIONTEXT: `.menu-action-text`,
40
            ACTIONTEXT: `.menu-action-text`,
42
            ICON: `.icon`,
41
            ICON: `.icon`,
43
        };
42
        };
Línea 78... Línea 77...
78
        } else {
77
        } else {
79
            selector = this.selectors.REMOVEMARKER;
78
            selector = this.selectors.REMOVEMARKER;
80
            newAction = this.formatActions.HIGHLIGHT;
79
            newAction = this.formatActions.HIGHLIGHT;
81
        }
80
        }
82
        // Find the affected action.
81
        // Find the affected action.
83
        const affectedAction = this.getElement(`${this.selectors.SECTION} ${selector}`, element.id);
82
        const affectedAction = this.getElement(`${selector}`, element.id);
84
        if (!affectedAction) {
83
        if (!affectedAction) {
85
            return;
84
            return;
86
        }
85
        }
87
        // Change action, text and icon.
86
        // Change action, text and icon.
88
        affectedAction.dataset.action = newAction;
87
        affectedAction.dataset.action = newAction;
Línea 108... Línea 107...
108
export const init = () => {
107
export const init = () => {
109
    // Add component to the section.
108
    // Add component to the section.
110
    const courseEditor = getCurrentCourseEditor();
109
    const courseEditor = getCurrentCourseEditor();
111
    if (courseEditor.supportComponents && courseEditor.isEditing) {
110
    if (courseEditor.supportComponents && courseEditor.isEditing) {
112
        new HighlightSection({
111
        new HighlightSection({
113
            element: document.getElementById('region-main'),
112
            element: document.getElementById('page'),
114
            reactive: courseEditor,
113
            reactive: courseEditor,
115
        });
114
        });
116
    }
115
    }
117
};
116
};