Dotclear

Changeset 3897:61304e9616a6 for plugins


Ignore:
Timestamp:
10/01/18 11:24:07 (7 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Set correct lang attribute (useful for browser/editor spelling) for content (post/page) depending on entry setting, and CK editor UI in user language

Location:
plugins
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • plugins/dcCKEditor/_post_config.php

    r3769 r3897  
    108108<?php endif;?> 
    109109 
     110    CKEDITOR.config.defaultLanguage = dotclear.user_language; 
     111    CKEDITOR.config.language = dotclear.user_language; 
     112    CKEDITOR.config.contentsLanguage = dotclear.user_language; 
     113 
    110114<?php 
    111115if (!empty($extraPlugins) && count($extraPlugins) > 0) { 
     
    237241 
    238242    CKEDITOR.on('instanceLoaded',function(e) { 
    239  
    240243        // Retrieve textarea element of the instance, then its line-height (in px) and rows values, 
    241244        // then apply line-height * rows (min = 6) to the inner height of the instance. 
     
    250253            } 
    251254        } 
    252  
    253255    }); 
    254256 
     
    268270        }); 
    269271 
     272        const ta = document.getElementById(e.editor.name); 
     273        if (ta !== undefined) { 
     274            if (ta.lang && e.editor.config.contentsLanguage !== ta.lang) { 
     275                let config = e.editor.config; 
     276                config.contentsLanguage = ta.lang; 
     277                e.editor.destroy(); 
     278                CKEDITOR.replace(e.editor.name, config); 
     279            } 
     280        } 
    270281    }); 
    271282 
  • plugins/dcCKEditor/inc/dc.ckeditor.behaviors.php

    r3874 r3897  
    4040        dcPage::jsVar('dotclear.base_url', $GLOBALS['core']->blog->host) . 
    4141        dcPage::jsVar('dotclear.dcckeditor_plugin_url', DC_ADMIN_URL . self::$p_url) . 
     42        dcPage::jsVar('dotclear.user_language', $GLOBALS['core']->auth->getInfo('user_lang')) . 
    4243        'CKEDITOR_GETURL = function(resource) { 
    4344                // If this is not a full or absolute path. 
  • plugins/dcLegacyEditor/js/jsToolBar/jsToolBar.wysiwyg.js

    r3880 r3897  
    188188    } 
    189189 
     190    // Set lang if set for the textarea 
     191    if (This.textarea.lang) { 
     192      doc.documentElement.setAttribute('lang', This.textarea.lang); 
     193    } 
     194 
    190195    This.iwin = This.iframe.contentWindow; 
    191196 
  • plugins/pages/page.php

    r3878 r3897  
    487487        '<p class="area" id="excerpt-area"><label for="post_excerpt" class="bold">' . __('Excerpt:') . ' <span class="form-note">' . 
    488488        __('Introduction to the page.') . '</span></label> ' . 
    489         form::textarea('post_excerpt', 50, 5, html::escapeHTML($post_excerpt)) . 
     489        form::textarea('post_excerpt', 50, 5, 
     490            [ 
     491                'default'    => html::escapeHTML($post_excerpt), 
     492                'extra_html' => 'lang="' . $post_lang . '"' 
     493            ]) . 
    490494        '</p>', 
    491495 
     
    496500            [ 
    497501                'default'    => html::escapeHTML($post_content), 
    498                 'extra_html' => 'required placeholder="' . __('Content') . '"' 
     502                'extra_html' => 'required placeholder="' . __('Content') . '" lang="' . $post_lang . '"' 
    499503            ]) . 
    500504        '</p>', 
Note: See TracChangeset for help on using the changeset viewer.

Sites map