From fc2e1fa0381bfc36d9d0d1c4349381bafc9843bc Mon Sep 17 00:00:00 2001 From: Agriya Dev5 Date: Sat, 22 May 2021 12:53:36 +0530 Subject: [PATCH] #102 coponent i18n new approach changes --- .../components/jgraduate/jQuery.jGraduate.js | 72 ++++++++++--------- .../components/jgraduate/jQuery.jPicker.js | 38 +++++----- src/editor/components/seColorPicker.js | 5 +- 3 files changed, 60 insertions(+), 55 deletions(-) diff --git a/src/editor/components/jgraduate/jQuery.jGraduate.js b/src/editor/components/jgraduate/jQuery.jGraduate.js index 6e14a3bd..22ef3182 100644 --- a/src/editor/components/jgraduate/jQuery.jGraduate.js +++ b/src/editor/components/jgraduate/jQuery.jGraduate.js @@ -1,7 +1,6 @@ /* eslint-disable no-loop-func */ /* eslint-disable prefer-destructuring */ /* eslint-disable no-unsanitized/property */ -/* gl#bals svgEditor */ /** * @file jGraduate 0.4 * @@ -189,7 +188,7 @@ function mkElem (name, attrs, newparent) { * @param {external:jQuery.fn.jGraduate.CancelCallback} [cancelCallback] Called with no arguments when Cancel is pressed * @returns {external:jQuery} */ -export function jGraduateMethod (elem, options, okCallback, cancelCallback) { +export function jGraduateMethod (elem, options, okCallback, cancelCallback, i18next) { const $this = elem, $settings = Object.assign({}, jGraduateDefaults, options || {}), id = $this.getAttribute('id'), @@ -237,9 +236,9 @@ export function jGraduateMethod (elem, options, okCallback, cancelCallback) { $this.classList.add('jGraduate_Picker'); // eslint-disable-next-line no-unsanitized/property $this.innerHTML = `
@@ -256,88 +255,88 @@ export function jGraduateMethod (elem, options, okCallback, cancelCallback) {
- +
- + - +
- +
- + - +
- +
- + - +
- +
-
+
- + - +
- +
- -
+ +
- -
+ +
- -
+ +
- +
- -
+ +
- - + +
`; const div = document.createElement('div'); div.innerHTML = html; @@ -637,7 +636,9 @@ export function jGraduateMethod (elem, options, okCallback, cancelCallback) { }, null, function () { $this.querySelector('#jGraduate_LightBox').style.display = 'none'; $this.querySelector('#' + id + '_jGraduate_stopPicker').style.display = 'none'; - }); + }, + i18next + ); }); const jqStopEls = curGradient.querySelectorAll('stop'); for (const jqStopEl of jqStopEls) { @@ -1197,7 +1198,8 @@ export function jGraduateMethod (elem, options, okCallback, cancelCallback) { okClicked(); }, null, - function () { cancelClicked(); } + function () { cancelClicked(); }, + i18next ); // JFH !!!! diff --git a/src/editor/components/jgraduate/jQuery.jPicker.js b/src/editor/components/jgraduate/jQuery.jPicker.js index 61b0190f..b4f6ce55 100755 --- a/src/editor/components/jgraduate/jQuery.jPicker.js +++ b/src/editor/components/jgraduate/jQuery.jPicker.js @@ -603,7 +603,7 @@ const { Color, List, ColorMethods } = jPicker; // local copies for YUI compresso * @param {module:jPicker.CancelCallback} [cancelCallback] * @returns {void} */ -export function jPickerMethod (elem, options, commitCallback, liveCallback, cancelCallback) { +export function jPickerMethod (elem, options, commitCallback, liveCallback, cancelCallback, i18next) { let sets = mergeDeep({}, jPickerDefaults); // local copies for YUI compressor sets = mergeDeep(sets, options); @@ -632,7 +632,7 @@ export function jPickerMethod (elem, options, commitCallback, liveCallback, canc content.innerHTML = `     -   +     `; that.insertAdjacentElement('afterend', content); @@ -1331,39 +1331,39 @@ export function jPickerMethod (elem, options, commitCallback, liveCallback, canc

${win.title || 'config.jpicker_title'}

   
      
- #svgEditor.i18next.t('config.jpicker_new_color')}
  
#svgEditor.i18next.t('config.jpicker_current_color')} -
+ ${i18next.t('config.jpicker_new_color')}
  
${i18next.t('config.jpicker_current_color')} +
- -  ° + +  ° - -  % + +  % -

-  %

+

+  %

- - + + - - + + - - + + - ${win.alphaSupport ? `` : ' '} - ${win.alphaSupport ? ` %` : ' '} + ${win.alphaSupport ? `` : ' '} + ${win.alphaSupport ? ` %` : ' '} - ${win.alphaSupport ? `` : ' '} + ${win.alphaSupport ? `` : ' '} `; if (win.expandable) { diff --git a/src/editor/components/seColorPicker.js b/src/editor/components/seColorPicker.js index 10d2aad0..55570939 100644 --- a/src/editor/components/seColorPicker.js +++ b/src/editor/components/seColorPicker.js @@ -665,6 +665,7 @@ export class SeColorPicker extends HTMLElement { this.$label = this._shadowRoot.getElementById('label'); this.$block = this._shadowRoot.getElementById('block'); this.paintBox = null; + this.i18next = null; this.$picker = this._shadowRoot.getElementById('picker'); this.$color_picker = this._shadowRoot.getElementById('color_picker'); } @@ -674,6 +675,7 @@ export class SeColorPicker extends HTMLElement { * @returns {void} */ init (i18next) { + this.i18next = i18next; this.setAttribute('config-change_xxx_color', i18next.t('config.change_xxx_color')); } /** @@ -807,7 +809,8 @@ export class SeColorPicker extends HTMLElement { }, () => { this.$color_picker.style.display = 'none'; - } + }, + this.i18next ); }); }