Improvements for #62

This commit is contained in:
djmaze 2021-03-25 10:08:29 +01:00
parent 23e15fd161
commit 673bd49095
12 changed files with 45 additions and 59 deletions

12
dev/External/ko.js vendored
View file

@ -1,4 +1,4 @@
import { i18n, i18nToNodes, trigger } from 'Common/Translator';
import { i18nToNodes } from 'Common/Translator';
import { doc, createElement } from 'Common/Globals';
import { SaveSettingsStep } from 'Common/Enums';
import { isNonEmptyArray, isFunction } from 'Common/Utils';
@ -6,16 +6,6 @@ import { isNonEmptyArray, isFunction } from 'Common/Utils';
const
koValue = value => !ko.isObservable(value) && isFunction(value) ? value() : ko.unwrap(value);
ko.bindingHandlers.tooltip = {
init: (element, fValueAccessor) => {
const sValue = koValue(fValueAccessor());
element.title = i18n(sValue);
trigger.subscribe(() => element.title = i18n(sValue));
},
update: (element, fValueAccessor) =>
element.title = i18n(koValue(fValueAccessor()))
};
ko.bindingHandlers.tooltipErrorTip = {
init: element => {
doc.addEventListener('click', () => element.removeAttribute('data-rainloopErrorTip'));