Fixes #21718 This is a PR for review of approach that I have come up with refactor for issue : #21718. We can discuss the approach in the comments. This PR moves autocomplete suggestions from a static utility file, entityDefinitions, to widget/index.ts file of each widget. This refactor will help in the long term project of moving widgets into its own module as well as support for custom widgets.
68 lines
1.8 KiB
TypeScript
68 lines
1.8 KiB
TypeScript
import { Alignment } from "@blueprintjs/core";
|
|
import { LabelPosition } from "components/constants";
|
|
import { FILL_WIDGET_MIN_WIDTH } from "constants/minWidthConstants";
|
|
import { ResponsiveBehavior } from "utils/autoLayout/constants";
|
|
import { DynamicHeight } from "utils/WidgetFeatures";
|
|
|
|
import IconSVG from "./icon.svg";
|
|
import Widget from "./widget";
|
|
|
|
export const CONFIG = {
|
|
type: Widget.getWidgetType(),
|
|
name: "Rich Text Editor",
|
|
iconSVG: IconSVG,
|
|
needsMeta: true,
|
|
searchTags: ["input", "rte"],
|
|
features: {
|
|
dynamicHeight: {
|
|
sectionIndex: 3,
|
|
defaultValue: DynamicHeight.FIXED,
|
|
active: true,
|
|
},
|
|
},
|
|
defaults: {
|
|
defaultText: "This is the initial <b>content</b> of the editor",
|
|
rows: 20,
|
|
columns: 24,
|
|
animateLoading: true,
|
|
isDisabled: false,
|
|
isVisible: true,
|
|
isRequired: false,
|
|
widgetName: "RichTextEditor",
|
|
isDefaultClickDisabled: true,
|
|
inputType: "html",
|
|
labelText: "Label",
|
|
labelPosition: LabelPosition.Top,
|
|
labelAlignment: Alignment.LEFT,
|
|
labelWidth: 5,
|
|
version: 1,
|
|
responsiveBehavior: ResponsiveBehavior.Fill,
|
|
minWidth: FILL_WIDGET_MIN_WIDTH,
|
|
},
|
|
properties: {
|
|
derived: Widget.getDerivedPropertiesMap(),
|
|
default: Widget.getDefaultPropertiesMap(),
|
|
meta: Widget.getMetaPropertiesMap(),
|
|
config: Widget.getPropertyPaneConfig(),
|
|
contentConfig: Widget.getPropertyPaneContentConfig(),
|
|
styleConfig: Widget.getPropertyPaneStyleConfig(),
|
|
stylesheetConfig: Widget.getStylesheetConfig(),
|
|
autocompleteDefinitions: Widget.getAutocompleteDefinitions(),
|
|
},
|
|
autoLayout: {
|
|
widgetSize: [
|
|
{
|
|
viewportMinWidth: 0,
|
|
configuration: () => {
|
|
return {
|
|
minWidth: "280px",
|
|
minHeight: "300px",
|
|
};
|
|
},
|
|
},
|
|
],
|
|
},
|
|
};
|
|
|
|
export default Widget;
|