@aglyn/besigner-ui 1.0.0-beta.277 → 1.0.0-beta.282
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +17 -17
- package/src/lib/components/dnd/draggable-droppable.js +49 -6
- package/src/lib/components/dnd/draggable-droppable.js.map +1 -1
- package/src/lib/components/element-props-form.component.d.ts +15 -2
- package/src/lib/components/element-props-form.component.js +160 -21
- package/src/lib/components/element-props-form.component.js.map +1 -1
- package/src/lib/components/inline-text-editor.component.js +117 -97
- package/src/lib/components/inline-text-editor.component.js.map +1 -1
- package/src/lib/components/node-leaf.d.ts +17 -0
- package/src/lib/components/node-leaf.js +169 -58
- package/src/lib/components/node-leaf.js.map +1 -1
- package/src/lib/components/node-outline.d.ts +8 -0
- package/src/lib/components/node-outline.js +39 -4
- package/src/lib/components/node-outline.js.map +1 -1
- package/src/lib/components/node-overlay.js +76 -8
- package/src/lib/components/node-overlay.js.map +1 -1
- package/src/lib/components/rich-text-field.component.d.ts +68 -0
- package/src/lib/components/rich-text-field.component.js +405 -0
- package/src/lib/components/rich-text-field.component.js.map +1 -0
- package/src/lib/components/token-pill.component.d.ts +18 -0
- package/src/lib/components/token-pill.component.js +49 -2
- package/src/lib/components/token-pill.component.js.map +1 -1
- package/src/lib/components/viewport-frame.component.js +24 -18
- package/src/lib/components/viewport-frame.component.js.map +1 -1
- package/src/lib/contexts/canvas-chrome-theme-context.d.ts +29 -0
- package/src/lib/contexts/canvas-chrome-theme-context.js +30 -0
- package/src/lib/contexts/canvas-chrome-theme-context.js.map +1 -0
- package/src/lib/contexts/repeat-record-context.d.ts +8 -0
- package/src/lib/contexts/repeat-record-context.js +8 -0
- package/src/lib/contexts/repeat-record-context.js.map +1 -1
- package/src/lib/hooks/use-besigner-document.d.ts +19 -0
- package/src/lib/hooks/use-besigner-document.js +4 -2
- package/src/lib/hooks/use-besigner-document.js.map +1 -1
- package/src/lib/hooks/use-repeat-preview.d.ts +8 -0
- package/src/lib/hooks/use-repeat-preview.js +72 -16
- package/src/lib/hooks/use-repeat-preview.js.map +1 -1
- package/src/lib/utils/attribute-focus-request.d.ts +34 -0
- package/src/lib/utils/attribute-focus-request.js +38 -0
- package/src/lib/utils/attribute-focus-request.js.map +1 -0
- package/src/lib/utils/docs-help.generated.d.ts +1 -1
- package/src/lib/utils/docs-help.generated.js +1 -1
- package/src/lib/utils/docs-help.generated.js.map +1 -1
- package/src/lib/utils/in-place-edit-surface.d.ts +14 -0
- package/src/lib/utils/in-place-edit-surface.js +41 -0
- package/src/lib/utils/in-place-edit-surface.js.map +1 -1
- package/src/lib/utils/inline-text-edit.store.d.ts +15 -0
- package/src/lib/utils/inline-text-edit.store.js.map +1 -1
- package/src/lib/utils/repeat-copy.d.ts +9 -0
- package/src/lib/utils/repeat-copy.js +17 -0
- package/src/lib/utils/repeat-copy.js.map +1 -1
- package/src/lib/utils/rich-text-commands.d.ts +15 -0
- package/src/lib/utils/rich-text-commands.js +40 -0
- package/src/lib/utils/rich-text-commands.js.map +1 -1
- package/src/lib/utils/sanitize-rich-text.d.ts +9 -0
- package/src/lib/utils/sanitize-rich-text.js +10 -0
- package/src/lib/utils/sanitize-rich-text.js.map +1 -1
|
@@ -18,7 +18,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
18
18
|
* limitations under the License.
|
|
19
19
|
*/ import PluginSettingsField, { PLUGIN_SETTINGS_FIELD_COMPONENT } from "./plugin-settings-field.component.js";
|
|
20
20
|
import { isMediaPickerKind } from "@aglyn/aglyn/app-utils/media-picker-context";
|
|
21
|
-
import { ANIMATION_DEFAULT_DELAY_MS, ANIMATION_DEFAULT_DURATION_MS, ANIMATION_DEFAULT_EASE, ANIMATION_DEFAULT_STAGGER_STEP_MS, ANIMATION_DEFAULT_TRIGGER, ANIMATION_MAX_DURATION_MS, ANIMATION_MAX_STAGGER_STEP_MS, ANIMATION_NONE, ANIMATION_PRESETS, canvas, COMPONENT_PROP_NAME_PATTERN, components, displayBindingTokens, ENTITY_PICKER_BROWSE_LIMIT, entityListState, EntityPickerContext, entityValueNeedsResolution, FEATURE_FLAG, FieldComponentType, getKnownPluginInstalls, getKnownPluginInstallsVersion, hasBindings, inheritedMediaAlt, intrinsicMediaSize, linkTargetKind, VIDEO_COMPONENT_ID, videoMediaProps, MISSING_BINDING_LABEL, NODE_ANIMATION_DELAY_PROP, NODE_ANIMATION_DURATION_PROP, NODE_ANIMATION_EASE_PROP, NODE_ANIMATION_PROP, NODE_ANIMATION_REPEAT_PROP, NODE_ANIMATION_STAGGER_PROP, NODE_ANIMATION_STAGGER_STEP_PROP, NODE_ANIMATION_TRIGGER_PROP, NODE_HIDE_IF_PROP, isPlacedFormNode, formPropsOnBind, FORM_COMPONENT_ID, NODE_HIDE_UNLESS_PROP, normalizeBindingTokens, readInstanceIconValue, readReusablePropValue, readYesNoValue, reusablePropConditionValue, reusablePropDefaultValue, reusablePropKind, reusablePropTakesSeveral, evaluateReusablePropRule, REUSABLE_INSTANCE_COMPONENT_ID, REUSABLE_INSTANCE_PROP_VALUES_KEY, ScreenLinkContext, screenLinkTargetOptions, subscribeKnownPluginInstalls, unresolvedScreenOption } from "@aglyn/aglyn";
|
|
21
|
+
import { ANIMATION_DEFAULT_DELAY_MS, ANIMATION_DEFAULT_DURATION_MS, ANIMATION_DEFAULT_EASE, ANIMATION_DEFAULT_STAGGER_STEP_MS, ANIMATION_DEFAULT_TRIGGER, ANIMATION_MAX_DURATION_MS, ANIMATION_MAX_STAGGER_STEP_MS, ANIMATION_NONE, ANIMATION_PRESETS, canvas, COMPONENT_PROP_NAME_PATTERN, components, displayBindingTokens, ENTITY_PICKER_BROWSE_LIMIT, entityListState, EntityPickerContext, entityValueNeedsResolution, FEATURE_FLAG, FieldComponentType, getKnownPluginInstalls, getKnownPluginInstallsVersion, hasBindings, inheritedMediaAlt, intrinsicMediaSize, linkTargetKind, VIDEO_COMPONENT_ID, videoMediaProps, MISSING_BINDING_LABEL, NODE_ANIMATION_DELAY_PROP, NODE_ANIMATION_DURATION_PROP, NODE_ANIMATION_EASE_PROP, NODE_ANIMATION_PROP, NODE_ANIMATION_REPEAT_PROP, NODE_ANIMATION_STAGGER_PROP, NODE_ANIMATION_STAGGER_STEP_PROP, NODE_ANIMATION_TRIGGER_PROP, NODE_HIDE_IF_PROP, isPlacedFormNode, formPropsOnBind, FORM_COMPONENT_ID, NODE_HIDE_UNLESS_PROP, normalizeBindingTokens, readInstanceIconValue, readReusablePropValue, readYesNoValue, reusablePropConditionValue, reusablePropDefaultValue, reusablePropKind, reusablePropTakesSeveral, evaluateReusablePropRule, REUSABLE_INSTANCE_COMPONENT_ID, REUSABLE_INSTANCE_PROP_HTML_KEY, REUSABLE_INSTANCE_PROP_VALUES_KEY, listPropFedTextNodeIds, ScreenLinkContext, screenLinkTargetOptions, subscribeKnownPluginInstalls, unresolvedScreenOption } from "@aglyn/aglyn";
|
|
22
22
|
// By path, not the `@aglyn/aglyn` barrel: a repeat's bounds and the sources
|
|
23
23
|
// an editor offers are editor business, and a published page must not pull
|
|
24
24
|
// either in behind them.
|
|
@@ -35,13 +35,17 @@ import { Alert, NoSsr, Tooltip } from "@mui/material";
|
|
|
35
35
|
import Box from "@mui/material/Box";
|
|
36
36
|
import Button from "@mui/material/Button";
|
|
37
37
|
import FormControl from "@mui/material/FormControl";
|
|
38
|
-
import { Grid } from "@mui/material";
|
|
38
|
+
import { alpha, Grid, useTheme } from "@mui/material";
|
|
39
|
+
import { reaction } from "mobx";
|
|
39
40
|
import { observer } from "mobx-react-lite";
|
|
41
|
+
import { attributeFocusRequest, clearAttributeFocusRequest } from "../utils/attribute-focus-request.js";
|
|
40
42
|
import * as Besigner from "@aglyn/besigner";
|
|
41
43
|
import { forwardRef, memo, useCallback, useContext, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
42
44
|
import { BindingPickerContext } from "../contexts/binding-picker-context.js";
|
|
43
45
|
import { InsertTokenMenu } from "./insert-token-menu.component.js";
|
|
44
46
|
import { TokenTextField, TOKEN_TEXT_FIELD_COMPONENT } from "./token-text-field.component.js";
|
|
47
|
+
import { RICH_TEXT_FIELD_COMPONENT, RichTextField } from "./rich-text-field.component.js";
|
|
48
|
+
import { richTextCommandGroups } from "../utils/rich-text-commands.js";
|
|
45
49
|
import { MarkdownAttributeField, MARKDOWN_ATTRIBUTE_FIELD_COMPONENT } from "./markdown-attribute-field.component.js";
|
|
46
50
|
import { ScreenLinkField, ScreenTargetField, SCREEN_LINK_FIELD_COMPONENT, SCREEN_TARGET_FIELD_COMPONENT } from "./screen-link-field.component.js";
|
|
47
51
|
import { PropertyBindingField, PROPERTY_BINDING_FIELD_COMPONENT, withPropertyBinding } from "./property-binding-field.component.js";
|
|
@@ -89,15 +93,28 @@ const AutoSaveOnChange = /*#__PURE__*/ memo(function AutoSaveOnChange({ values,
|
|
|
89
93
|
* Whether a node's text is FORMATTED — it carries a `html` prop the renderer
|
|
90
94
|
* draws in preference to `children` (AGL-2486).
|
|
91
95
|
*
|
|
92
|
-
* An instance
|
|
93
|
-
*
|
|
96
|
+
* An instance's text rides its props instead: formatted when any of them has
|
|
97
|
+
* markup in `propHtml` beside its value.
|
|
94
98
|
*/ export function isFormattedText(node) {
|
|
95
99
|
var _node_props;
|
|
96
100
|
if (!node) return false;
|
|
97
|
-
if (node.componentId === REUSABLE_INSTANCE_COMPONENT_ID)
|
|
101
|
+
if (node.componentId === REUSABLE_INSTANCE_COMPONENT_ID) {
|
|
102
|
+
return Object.keys(instanceFormattedProps(node.props)).length > 0;
|
|
103
|
+
}
|
|
98
104
|
const html = (_node_props = node.props) == null ? void 0 : _node_props.html;
|
|
99
105
|
return typeof html === 'string' && html.length > 0;
|
|
100
106
|
}
|
|
107
|
+
/** An instance's formatted props, as their non-empty markup by prop name. */ export function instanceFormattedProps(props) {
|
|
108
|
+
const stored = props == null ? void 0 : props[REUSABLE_INSTANCE_PROP_HTML_KEY];
|
|
109
|
+
const formatted = {};
|
|
110
|
+
if (!stored || typeof stored !== 'object' || Array.isArray(stored)) {
|
|
111
|
+
return formatted;
|
|
112
|
+
}
|
|
113
|
+
for (const [name, markup] of Object.entries(stored)){
|
|
114
|
+
if (typeof markup === 'string' && markup) formatted[name] = markup;
|
|
115
|
+
}
|
|
116
|
+
return formatted;
|
|
117
|
+
}
|
|
101
118
|
/**
|
|
102
119
|
* The same props with the formatting dropped and the words kept
|
|
103
120
|
* (AGL-2486).
|
|
@@ -109,6 +126,8 @@ const AutoSaveOnChange = /*#__PURE__*/ memo(function AutoSaveOnChange({ values,
|
|
|
109
126
|
*/ export function withoutFormatting(props) {
|
|
110
127
|
const next = _extends({}, props != null ? props : {});
|
|
111
128
|
delete next['html'];
|
|
129
|
+
// An instance's props keep their words in `propValues` the same way.
|
|
130
|
+
delete next[REUSABLE_INSTANCE_PROP_HTML_KEY];
|
|
112
131
|
return next;
|
|
113
132
|
}
|
|
114
133
|
export const ElementPropsFormTemplate = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
@@ -224,6 +243,9 @@ export const elementPropsComponentMapper = _extends({}, simpleComponentMapper, {
|
|
|
224
243
|
// Pill-rendering editor for token-capable free-text attributes
|
|
225
244
|
// (AGL-586); the attributes memo rewrites TEXT_FIELD/TEXTAREA to it.
|
|
226
245
|
[TOKEN_TEXT_FIELD_COMPONENT]: TokenTextField,
|
|
246
|
+
// Formatted text, edited with its formatting (AGL-2486); the resolver
|
|
247
|
+
// rewrites a text field to it where the element takes markup.
|
|
248
|
+
[RICH_TEXT_FIELD_COMPONENT]: RichTextField,
|
|
227
249
|
// Screen picker + external-URL escape hatch for `Link`-typed component
|
|
228
250
|
// props (AGL-1335), which were plain text boxes storing a raw path.
|
|
229
251
|
[SCREEN_LINK_FIELD_COMPONENT]: ScreenLinkField,
|
|
@@ -719,7 +741,7 @@ export const elementPropsComponentMapper = _extends({}, simpleComponentMapper, {
|
|
|
719
741
|
* through it, so a kind cannot draw one way as an attribute and another as a
|
|
720
742
|
* property.
|
|
721
743
|
*/ export function resolveAttributeField(field, context = {}) {
|
|
722
|
-
const { screens, labels, values, entityOptions = {}, nodeOptions = [], ancestorDatasetId, hasFormattedText, insertOptions, tokenLabelContext } = context;
|
|
744
|
+
const { screens, labels, values, entityOptions = {}, nodeOptions = [], ancestorDatasetId, hasFormattedText, richTextFields, insertOptions, tokenLabelContext } = context;
|
|
723
745
|
const stored = readAttributeFieldValue(values, field.name);
|
|
724
746
|
if (field.component === FieldComponentType.SCREEN_SELECT) {
|
|
725
747
|
// The host's screens by path, then its collection listings
|
|
@@ -841,10 +863,24 @@ export const elementPropsComponentMapper = _extends({}, simpleComponentMapper, {
|
|
|
841
863
|
type: field.component === FieldComponentType.DATE_PICKER ? 'date' : 'time'
|
|
842
864
|
});
|
|
843
865
|
}
|
|
844
|
-
// Formatted text
|
|
845
|
-
// the
|
|
846
|
-
//
|
|
847
|
-
|
|
866
|
+
// Formatted text, where the element takes it, is edited WITH its
|
|
867
|
+
// formatting (AGL-2486) — the same tools as the canvas editor, and both
|
|
868
|
+
// halves written together.
|
|
869
|
+
const rich = richTextFields == null ? void 0 : richTextFields[field.name];
|
|
870
|
+
if (rich && !field.isReadOnly && (field.component === FieldComponentType.TEXT_FIELD || field.component === FieldComponentType.TEXTAREA || field.component === TOKEN_TEXT_FIELD_COMPONENT)) {
|
|
871
|
+
return _extends({}, field, {
|
|
872
|
+
component: RICH_TEXT_FIELD_COMPONENT,
|
|
873
|
+
markupName: rich.markupName,
|
|
874
|
+
richCommands: rich.commands,
|
|
875
|
+
tokenOptions: insertOptions,
|
|
876
|
+
tokenLabelContext
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
// Markup on an element that cannot take it any more — its component
|
|
880
|
+
// stopped declaring rich text. Shown, with the reason, rather than
|
|
881
|
+
// silently editable into a prop the renderer ignores.
|
|
882
|
+
const formattedProp = field.name.startsWith(`${REUSABLE_INSTANCE_PROP_VALUES_KEY}.`) && Boolean(instanceFormattedProps(values)[field.name.slice(REUSABLE_INSTANCE_PROP_VALUES_KEY.length + 1)]);
|
|
883
|
+
if (field.name === 'children' && hasFormattedText || formattedProp) {
|
|
848
884
|
return _extends({}, field, {
|
|
849
885
|
component: TOKEN_TEXT_FIELD_COMPONENT,
|
|
850
886
|
multiline: true,
|
|
@@ -1700,15 +1736,64 @@ const ElementPropsFormRaw = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
1700
1736
|
* so typing here changes a prop nothing renders. The field appears to do
|
|
1701
1737
|
* nothing, which is the worst of the three possible behaviours.
|
|
1702
1738
|
*
|
|
1703
|
-
*
|
|
1704
|
-
*
|
|
1705
|
-
*
|
|
1706
|
-
*
|
|
1707
|
-
*
|
|
1708
|
-
*
|
|
1709
|
-
*
|
|
1710
|
-
*
|
|
1739
|
+
* Letting a plain edit silently clear `html` was rejected: typing one
|
|
1740
|
+
* character would lose every link in the paragraph, with no sign until
|
|
1741
|
+
* the damage was done. Merging plain text back into markup was rejected
|
|
1742
|
+
* too: mapping arbitrary text onto a marked-up tree has no correct answer
|
|
1743
|
+
* once the edit is structural. So the field edits the MARKUP itself — a
|
|
1744
|
+
* rich field with the canvas editor's tools — wherever the element takes
|
|
1745
|
+
* it (`richTextFields`), and is read-only only for markup on an element
|
|
1746
|
+
* that no longer does. Dropping the formatting stays an explicit,
|
|
1747
|
+
* undoable act — see {@link handleRemoveFormatting}.
|
|
1711
1748
|
*/ const hasFormattedText = isFormattedText(node);
|
|
1749
|
+
/**
|
|
1750
|
+
* The text fields that edit formatted text (AGL-2486), by field name.
|
|
1751
|
+
*
|
|
1752
|
+
* An element's own Text where its component takes markup. An instance's
|
|
1753
|
+
* text prop where EVERY element the prop fills takes markup — the graft
|
|
1754
|
+
* hands the prop's markup to each of them — with the formatting the
|
|
1755
|
+
* first one allows, as the canvas editor decides it.
|
|
1756
|
+
*/ const richTextFields = useMemo(()=>{
|
|
1757
|
+
var _node_props;
|
|
1758
|
+
const fields = {};
|
|
1759
|
+
const takesMarkup = (componentSchema)=>{
|
|
1760
|
+
var _ref;
|
|
1761
|
+
var _componentSchema_flags;
|
|
1762
|
+
return (((_ref = componentSchema == null ? void 0 : (_componentSchema_flags = componentSchema.flags) == null ? void 0 : _componentSchema_flags.richTextEditable) != null ? _ref : FEATURE_FLAG.DISABLED) & FEATURE_FLAG.ENABLED) !== 0;
|
|
1763
|
+
};
|
|
1764
|
+
if (takesMarkup(schema)) {
|
|
1765
|
+
fields['children'] = {
|
|
1766
|
+
markupName: 'html',
|
|
1767
|
+
commands: [
|
|
1768
|
+
...richTextCommandGroups(schema)
|
|
1769
|
+
]
|
|
1770
|
+
};
|
|
1771
|
+
}
|
|
1772
|
+
const refId = node == null ? void 0 : (_node_props = node.props) == null ? void 0 : _node_props.refId;
|
|
1773
|
+
const definition = isInstance && refId ? definitions == null ? void 0 : definitions[refId] : undefined;
|
|
1774
|
+
for (const prop of instanceDeclared != null ? instanceDeclared : []){
|
|
1775
|
+
if (!(prop == null ? void 0 : prop.name) || !(definition == null ? void 0 : definition.nodes)) continue;
|
|
1776
|
+
const fed = listPropFedTextNodeIds(definition.nodes, prop.name);
|
|
1777
|
+
const schemas = fed.map((id)=>{
|
|
1778
|
+
var _definition_nodes_id;
|
|
1779
|
+
return components.getSchema((_definition_nodes_id = definition.nodes[id]) == null ? void 0 : _definition_nodes_id.componentId);
|
|
1780
|
+
});
|
|
1781
|
+
if (!schemas.length || !schemas.every(takesMarkup)) continue;
|
|
1782
|
+
fields[`${REUSABLE_INSTANCE_PROP_VALUES_KEY}.${prop.name}`] = {
|
|
1783
|
+
markupName: `${REUSABLE_INSTANCE_PROP_HTML_KEY}.${prop.name}`,
|
|
1784
|
+
commands: [
|
|
1785
|
+
...richTextCommandGroups(schemas[0])
|
|
1786
|
+
]
|
|
1787
|
+
};
|
|
1788
|
+
}
|
|
1789
|
+
return fields;
|
|
1790
|
+
}, [
|
|
1791
|
+
schema,
|
|
1792
|
+
node,
|
|
1793
|
+
isInstance,
|
|
1794
|
+
definitions,
|
|
1795
|
+
instanceDeclared
|
|
1796
|
+
]);
|
|
1712
1797
|
// The props of the component being edited, set ONLY inside a component
|
|
1713
1798
|
// editor — the same "am I editing a definition" signal the insert picker
|
|
1714
1799
|
// keys `{{prop.*}}` off. It decides whether a field with no text box can
|
|
@@ -1746,6 +1831,7 @@ const ElementPropsFormRaw = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
1746
1831
|
nodeOptions,
|
|
1747
1832
|
ancestorDatasetId,
|
|
1748
1833
|
hasFormattedText,
|
|
1834
|
+
richTextFields,
|
|
1749
1835
|
insertOptions,
|
|
1750
1836
|
tokenLabelContext,
|
|
1751
1837
|
// The installed-plugin set arrives from a live subscription and can
|
|
@@ -1761,6 +1847,7 @@ const ElementPropsFormRaw = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
1761
1847
|
nodeOptions,
|
|
1762
1848
|
ancestorDatasetId,
|
|
1763
1849
|
hasFormattedText,
|
|
1850
|
+
richTextFields,
|
|
1764
1851
|
insertOptions,
|
|
1765
1852
|
tokenLabelContext,
|
|
1766
1853
|
knownPluginInstallsVersion
|
|
@@ -2169,6 +2256,53 @@ const ElementPropsFormRaw = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
2169
2256
|
placementFieldCount
|
|
2170
2257
|
]);
|
|
2171
2258
|
const handleFormCancel = useCallback((e, reason)=>{}, []);
|
|
2259
|
+
/**
|
|
2260
|
+
* Brings a field the canvas asked for into view (see
|
|
2261
|
+
* `attributeFocusRequest`): scrolled to, focused and briefly ringed, once
|
|
2262
|
+
* this form is showing the element it was asked for. The form renders a
|
|
2263
|
+
* frame or two after a selection changes, so the field is looked for until
|
|
2264
|
+
* it appears rather than once.
|
|
2265
|
+
*/ const panelTheme = useTheme();
|
|
2266
|
+
useEffect(()=>reaction(()=>attributeFocusRequest.get(), (request)=>{
|
|
2267
|
+
if (!request || request.nodeId !== (node == null ? void 0 : node.$id)) return;
|
|
2268
|
+
let frames = 0;
|
|
2269
|
+
const find = ()=>{
|
|
2270
|
+
var _ref, _field_querySelector;
|
|
2271
|
+
const input = document.querySelector(`[id="aglyn:panel-right"] [name="${request.field}"]`);
|
|
2272
|
+
const field = (_ref = input == null ? void 0 : input.closest('.MuiFormControl-root')) != null ? _ref : input;
|
|
2273
|
+
if (!field) {
|
|
2274
|
+
if (frames++ < 30) requestAnimationFrame(find);
|
|
2275
|
+
else clearAttributeFocusRequest();
|
|
2276
|
+
return;
|
|
2277
|
+
}
|
|
2278
|
+
clearAttributeFocusRequest();
|
|
2279
|
+
field.scrollIntoView({
|
|
2280
|
+
block: 'center',
|
|
2281
|
+
behavior: 'smooth'
|
|
2282
|
+
});
|
|
2283
|
+
const control = (_field_querySelector = field.querySelector('[role="combobox"], input:not([type="hidden"])')) != null ? _field_querySelector : input;
|
|
2284
|
+
control == null ? void 0 : control.focus({
|
|
2285
|
+
preventScroll: true
|
|
2286
|
+
});
|
|
2287
|
+
field.animate == null ? void 0 : field.animate.call(field, [
|
|
2288
|
+
{
|
|
2289
|
+
boxShadow: `0 0 0 ${panelTheme.spacing(0.25)} ${panelTheme.palette.secondary.main}`
|
|
2290
|
+
},
|
|
2291
|
+
{
|
|
2292
|
+
boxShadow: `0 0 0 ${panelTheme.spacing(0.25)} ${alpha(panelTheme.palette.secondary.main, 0)}`
|
|
2293
|
+
}
|
|
2294
|
+
], {
|
|
2295
|
+
duration: 1600,
|
|
2296
|
+
easing: 'ease-out'
|
|
2297
|
+
});
|
|
2298
|
+
};
|
|
2299
|
+
find();
|
|
2300
|
+
}, {
|
|
2301
|
+
fireImmediately: true
|
|
2302
|
+
}), [
|
|
2303
|
+
node == null ? void 0 : node.$id,
|
|
2304
|
+
panelTheme
|
|
2305
|
+
]);
|
|
2172
2306
|
const handleElementSave = useCallback((values)=>{
|
|
2173
2307
|
var _node_componentSchema;
|
|
2174
2308
|
// Hand-typed {{name}} tokens normalize to their rename-safe
|
|
@@ -2195,6 +2329,11 @@ const ElementPropsFormRaw = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
2195
2329
|
}
|
|
2196
2330
|
normalized[REUSABLE_INSTANCE_PROP_VALUES_KEY] = nextOverrides;
|
|
2197
2331
|
}
|
|
2332
|
+
// Formatting cleared from every prop leaves no container behind, so
|
|
2333
|
+
// the stored instance reads as one that was never formatted.
|
|
2334
|
+
if (REUSABLE_INSTANCE_PROP_HTML_KEY in normalized && !Object.keys(instanceFormattedProps(normalized)).length) {
|
|
2335
|
+
delete normalized[REUSABLE_INSTANCE_PROP_HTML_KEY];
|
|
2336
|
+
}
|
|
2198
2337
|
// Denormalize each picked icon's SVG path next to its id (AGL-1212) —
|
|
2199
2338
|
// see `iconPathsForSave` for why a miss does not always clear it.
|
|
2200
2339
|
Object.assign(normalized, iconPathsForSave(node == null ? void 0 : (_node_componentSchema = node.componentSchema) == null ? void 0 : _node_componentSchema.attributes, normalized, node == null ? void 0 : node.props));
|
|
@@ -2226,7 +2365,7 @@ const ElementPropsFormRaw = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
2226
2365
|
]);
|
|
2227
2366
|
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
2228
2367
|
children: [
|
|
2229
|
-
textEditable || hasTextAttributes ? /*#__PURE__*/ _jsxs(Box, {
|
|
2368
|
+
textEditable || hasTextAttributes || hasFormattedText ? /*#__PURE__*/ _jsxs(Box, {
|
|
2230
2369
|
sx: {
|
|
2231
2370
|
display: 'flex',
|
|
2232
2371
|
alignItems: 'center',
|
|
@@ -2262,8 +2401,8 @@ const ElementPropsFormRaw = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
2262
2401
|
}) : null,
|
|
2263
2402
|
hasFormattedText ? /*#__PURE__*/ _jsx(HelpTip, {
|
|
2264
2403
|
title: "This text is formatted",
|
|
2265
|
-
excerpt: "
|
|
2266
|
-
href: besignerDocsUrl('textEditing', '#text-field-
|
|
2404
|
+
excerpt: "Click into the field for the formatting toolbar, or double-click the element on the canvas. Remove formatting keeps the words and line breaks.",
|
|
2405
|
+
href: besignerDocsUrl('textEditing', '#text-field-formatting'),
|
|
2267
2406
|
sx: {
|
|
2268
2407
|
fontSize: '0.9em'
|
|
2269
2408
|
}
|