Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: LEAP-580: Display non-string values in Text #5326

Merged
merged 9 commits into from
Jan 23, 2024
2 changes: 1 addition & 1 deletion web/dist/apps/labelstudio/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/dist/apps/labelstudio/main.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/dist/libs/datamanager/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/dist/libs/datamanager/main.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/dist/libs/editor/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/dist/libs/editor/main.js.map

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions web/libs/editor/src/LabelStudio.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ export class LabelStudio {
};

const clearRenderedApp = () => {
if (!rootElement.childNodes?.length) return;

const childNodes = [...rootElement.childNodes];
// cleanDomAfterReact needs this key to be sure that cleaning affects only current react subtree
const reactKey = findReactKey(childNodes[0]);
Expand Down
14 changes: 1 addition & 13 deletions web/libs/editor/src/core/Hotkey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,10 @@ import { createElement, Fragment } from 'react';
import { Tooltip } from '../common/Tooltip/Tooltip';
import Hint from '../components/Hint/Hint';
import { Block, Elem } from '../utils/bem';
import { FF_LSDV_1148, FF_MULTI_OBJECT_HOTKEYS, isFF } from '../utils/feature-flags';
import { FF_LSDV_1148, isFF } from '../utils/feature-flags';
import { isDefined, isMacOS } from '../utils/utilities';
import defaultKeymap from './settings/keymap.json';

if (!isFF(FF_MULTI_OBJECT_HOTKEYS)) {
const prev = (defaultKeymap as Keymap)['image:prev'];
const next = (defaultKeymap as Keymap)['image:next'];

if (prev) {
prev.key = prev.mac = 'ctrl+a';
}
if (next) {
next.key = next.mac = 'ctrl+d';
}
}

// Validate keymap integrity
const allowedKeympaKeys = ['key', 'mac', 'description', 'modifier', 'modifierDescription'];

Expand Down
6 changes: 2 additions & 4 deletions web/libs/editor/src/core/settings/keymap.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,11 @@
"description": "Previous Page"
},
"image:prev": {
"key": "ctrl+left",
"mac": "command+left",
"key": "ctrl+a",
"description": "Previous Image"
},
"image:next": {
"key": "ctrl+right",
"mac": "command+right",
"key": "ctrl+d",
"description": "Next Image"
}
}
4 changes: 2 additions & 2 deletions web/libs/editor/src/regions/VideoRegion.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getRoot, types } from 'mobx-state-tree';
import { types } from 'mobx-state-tree';

import { guidGenerator } from '../core/Helpers';
import { AreaMixin } from '../mixins/AreaMixin';
Expand Down Expand Up @@ -34,7 +34,7 @@ const Model = types
},

get annotation() {
return getRoot(self)?.annotationStore?.selected;
return self.object.annotation;
},

getShape() {
Expand Down
2 changes: 1 addition & 1 deletion web/libs/editor/src/tags/object/RichText/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ const Model = types
// nodes count better be the same, so replace them with stubs
// we should not sanitize text tasks because we already have htmlEscape in view.js
if (isFF(FF_SAFE_TEXT) && self.type === 'text') {
self._value = val;
self._value = String(val);
} else {
self._value = sanitizeHtml(String(val));
}
Expand Down
4 changes: 2 additions & 2 deletions web/libs/editor/src/utils/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ export const parseValue = (value, task) => {

// value can refer to structures, not only texts, so just replace wouldn't be enough
if (value.match(reVar)?.[0] === value) {
return get(task, value.substr(1)) ?? '';
return get(task, value.slice(1)) ?? '';
}

return value.replace(reVar, (v) => get(task, v.substr(1) ?? ''));
return value.replace(reVar, (v) => get(task, v.slice(1) ?? ''));
};

/**
Expand Down
2 changes: 0 additions & 2 deletions web/libs/editor/src/utils/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,6 @@ export const FF_ZOOM_OPTIM = 'fflag_fix_front_leap_32_zoom_perf_190923_short';

export const FF_SAFE_TEXT = 'fflag_fix_leap_466_text_sanitization';

export const FF_MULTI_OBJECT_HOTKEYS = 'fflag_fix_leap_246_multi_object_hotkeys_160124_short';

Object.assign(window, {
APP_SETTINGS: {
...(window.APP_SETTINGS ?? {}),
Expand Down
Loading