@blockly/field-multilineinput 3.0.6 → 3.0.7

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/README.md CHANGED
@@ -5,11 +5,13 @@ A [Blockly](https://www.npmjs.com/package/blockly) multilineinput field.
5
5
  ## Installation
6
6
 
7
7
  ### Yarn
8
+
8
9
  ```
9
10
  yarn add @blockly/field-multilineinput
10
11
  ```
11
12
 
12
13
  ### npm
14
+
13
15
  ```
14
16
  npm install @blockly/field-multilineinput --save
15
17
  ```
@@ -17,31 +19,35 @@ npm install @blockly/field-multilineinput --save
17
19
  ## Usage
18
20
 
19
21
  This field accepts up to 3 parameters:
20
- * "text" to specify the default text. Defaults to `""`.
21
- * "maxLines" to specify the maximum number of lines displayed before scrolling
22
- functionality is enabled. Defaults to `Infinity`.
23
- * "spellcheck" to specify whether spell checking is enabled. Defaults to
22
+
23
+ - "text" to specify the default text. Defaults to `""`.
24
+ - "maxLines" to specify the maximum number of lines displayed before scrolling
25
+ functionality is enabled. Defaults to `Infinity`.
26
+ - "spellcheck" to specify whether spell checking is enabled. Defaults to
24
27
  `true`.
25
28
 
26
29
  The multiline input field is a subclass of Blockly.FieldInput
27
30
 
28
31
  ### JavaScript
32
+
29
33
  ```js
30
34
  import * as Blockly from 'blockly';
31
35
  import {FieldMultilineInput} from '@blockly/field-multilineinput';
32
36
 
33
- Blockly.Blocks["test_field_multilineinput"] = {
37
+ Blockly.Blocks['test_field_multilineinput'] = {
34
38
  init: function () {
35
39
  this.appendDummyInput()
36
- .appendField("multilineinput: ")
40
+ .appendField('multilineinput: ')
37
41
  .appendField(
38
- new FieldMultilineInput("some text \n with newlines"),
39
- "FIELDNAME");
40
- }
42
+ new FieldMultilineInput('some text \n with newlines'),
43
+ 'FIELDNAME',
44
+ );
45
+ },
41
46
  };
42
47
  ```
43
48
 
44
49
  ### JSON
50
+
45
51
  ```js
46
52
  import * as Blockly from 'blockly';
47
53
  import '@blockly/field-multilineinput';
@@ -61,12 +67,12 @@ Blockly.defineBlocksWithJsonArray([
61
67
 
62
68
  ### API reference
63
69
 
64
- * `setMaxLines`: Sets the maximum number of displayed lines before
70
+ - `setMaxLines`: Sets the maximum number of displayed lines before
65
71
  scrolling functionality is enabled.
66
- * `getMaxLines`: Returns the maximum number of displayed lines before
72
+ - `getMaxLines`: Returns the maximum number of displayed lines before
67
73
  scrolling functionality is enabled.
68
- * `setSpellcheck`: Sets whether spell checking is enabled.
69
- * `getSpellcheck`: Returns whether spell checking is enabled.
74
+ - `setSpellcheck`: Sets whether spell checking is enabled.
75
+ - `getSpellcheck`: Returns whether spell checking is enabled.
70
76
 
71
77
  ## License
72
78
 
@@ -176,5 +176,5 @@ export interface FieldMultilineInputFromJsonConfig extends FieldMultilineInputCo
176
176
  *
177
177
  * - `undefined` to set `newValue` as is.
178
178
  */
179
- export declare type FieldMultilineInputValidator = Blockly.FieldTextInputValidator;
179
+ export type FieldMultilineInputValidator = Blockly.FieldTextInputValidator;
180
180
  //# sourceMappingURL=field_multilineinput.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"field_multilineinput.d.ts","sourceRoot":"","sources":["../src/field_multilineinput.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AAEH,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AAGxC;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,OAAO,CAAC,cAAc;IAC7D;;;OAGG;IACH,SAAS,EAAE,WAAW,GAAC,IAAI,CAAQ;IAEnC;;;OAGG;IAEH,SAAS,CAAC,SAAS,SAAY;IAE/B,iDAAiD;IAEjD,SAAS,CAAC,cAAc,UAAS;IAEjC;;;;;;;;;;;;;;OAcG;gBAEC,KAAK,CAAC,EAAE,MAAM,GAAC,OAAO,OAAO,CAAC,KAAK,CAAC,UAAU,EAC9C,SAAS,CAAC,EAAE,4BAA4B,EACxC,MAAM,CAAC,EAAE,yBAAyB;IAatC;;;;OAIG;cAEgB,UAAU,CAA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F,gBAET3F,KAAKyI,iBAAiBlD,GACfA,CACX,CAOAjD,YAAYD,GACgB,iBAAbA,GAAyBA,EAAW,GAC3CA,IAAarC,KAAK+B,YAClB/B,KAAK+B,UAAYM,EACjBrC,KAAKyH,gBAEb,CAMAiB,cACI,OAAO1I,KAAK+B,SAChB,CAQA4G,oBAAoBpB,GACF,UAAVA,EAAE7G,KACFmB,MAAM8G,oBAAoBpB,EAElC,CASAqB,gBAAgBC,GAIZ,OAAO,IAAI7I,KAHE,yCAA+C6I,EAAQ7E,WAG9C1D,EAAWuI,EACrC,EAMJ,2BAAiC,uBACjC,yBAA+B,sBAAuBpH,GAItD,eAAqB","sources":["webpack://@blockly/field-multilineinput/webpack/universalModuleDefinition","webpack://@blockly/field-multilineinput/external umd {\"root\":\"Blockly\",\"commonjs\":\"blockly/core\",\"commonjs2\":\"blockly/core\",\"amd\":\"blockly/core\"}","webpack://@blockly/field-multilineinput/webpack/bootstrap","webpack://@blockly/field-multilineinput/webpack/runtime/define property getters","webpack://@blockly/field-multilineinput/webpack/runtime/hasOwnProperty shorthand","webpack://@blockly/field-multilineinput/webpack/runtime/make namespace object","webpack://@blockly/field-multilineinput/./src/field_multilineinput.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"blockly/core\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"blockly/core\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory(require(\"blockly/core\")) : factory(root[\"Blockly\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, (__WEBPACK_EXTERNAL_MODULE__573__) => {\nreturn ","module.exports = __WEBPACK_EXTERNAL_MODULE__573__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * @fileoverview Multiline text input field.\n */\nimport * as Blockly from 'blockly/core';\n/**\n * Class for an editable text area input field.\n */\nexport class FieldMultilineInput extends Blockly.FieldTextInput {\n /**\n * @param value The initial content of the field. Should cast to a string.\n * Defaults to an empty string if null or undefined. Also accepts\n * Field.SKIP_SETUP if you wish to skip setup (only used by subclasses\n * that want to handle configuration and setting the field value after\n * their own constructors have run).\n * @param validator An optional function that is called to validate any\n * constraints on what the user entered. Takes the new text as an\n * argument and returns either the accepted text, a replacement text, or\n * null to abort the change.\n * @param config A map of options used to configure the field.\n * See the [field creation documentation]{@link\n * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/multiline-text-input#creation}\n * for a list of properties this parameter supports.\n */\n constructor(value, validator, config) {\n super(Blockly.Field.SKIP_SETUP);\n /**\n * The SVG group element that will contain a text element for each text row\n * when initialized.\n */\n this.textGroup = null;\n /**\n * Defines the maximum number of lines of field.\n * If exceeded, scrolling functionality is enabled.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n this.maxLines_ = Infinity;\n /** Whether Y overflow is currently occurring. */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n this.isOverflowedY_ = false;\n if (value === Blockly.Field.SKIP_SETUP)\n return;\n if (config) {\n this.configure_(config);\n }\n this.setValue(value);\n if (validator) {\n this.setValidator(validator);\n }\n }\n /**\n * Configure the field based on the given map of options.\n *\n * @param config A map of options to configure the field based on.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n configure_(config) {\n super.configure_(config);\n if (config.maxLines)\n this.setMaxLines(config.maxLines);\n }\n /**\n * Serializes this field's value to XML.\n * Should only be called by Blockly.Xml.\n *\n * @param fieldElement The element to populate with info about the field's\n * state.\n * @returns The element containing info about the field's state.\n */\n toXml(fieldElement) {\n // Replace '\\n' characters with HTML-escaped equivalent '&#10'. This is\n // needed so the plain-text representation of the XML produced by\n // `Blockly.Xml.domToText` will appear on a single line (this is a\n // limitation of the plain-text format).\n fieldElement.textContent =\n this.getValue().replace(/\\n/g, '&#10;');\n return fieldElement;\n }\n /**\n * Sets the field's value based on the given XML element. Should only be\n * called by Blockly.Xml.\n *\n * @param fieldElement The element containing info about the field's state.\n */\n fromXml(fieldElement) {\n this.setValue(fieldElement.textContent.replace(/&#10;/g, '\\n'));\n }\n /**\n * Saves this field's value.\n * This function only exists for subclasses of FieldMultilineInput which\n * predate the load/saveState API and only define to/fromXml.\n *\n * @returns The state of this field.\n */\n saveState() {\n const legacyState = this.saveLegacyState(FieldMultilineInput);\n if (legacyState !== null) {\n return legacyState;\n }\n return this.getValue();\n }\n /**\n * Sets the field's value based on the given state.\n * This function only exists for subclasses of FieldMultilineInput which\n * predate the load/saveState API and only define to/fromXml.\n *\n * @param state The state of the variable to assign to this variable field.\n */\n loadState(state) {\n if (this.loadLegacyState(Blockly.Field, state)) {\n return;\n }\n this.setValue(state);\n }\n /**\n * Create the block UI for this field.\n */\n initView() {\n this.createBorderRect_();\n this.textGroup = Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.G, {\n 'class': 'blocklyEditableText',\n }, this.fieldGroup_);\n }\n /**\n * Get the text from this field as displayed on screen. May differ from\n * getText due to ellipsis, and other formatting.\n *\n * @returns Currently displayed text.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n getDisplayText_() {\n const block = this.getSourceBlock();\n if (!block) {\n throw new Error('The field has not yet been attached to its input. ' +\n 'Call appendField to attach it.');\n }\n let textLines = this.getText();\n if (!textLines) {\n // Prevent the field from disappearing if empty.\n return Blockly.Field.NBSP;\n }\n const lines = textLines.split('\\n');\n textLines = '';\n const displayLinesNumber = this.isOverflowedY_ ? this.maxLines_ : lines.length;\n for (let i = 0; i < displayLinesNumber; i++) {\n let text = lines[i];\n if (text.length > this.maxDisplayLength) {\n // Truncate displayed string and add an ellipsis ('...').\n text = text.substring(0, this.maxDisplayLength - 4) + '...';\n }\n else if (this.isOverflowedY_ && i === displayLinesNumber - 1) {\n text = text.substring(0, text.length - 3) + '...';\n }\n // Replace whitespace with non-breaking spaces so the text doesn't\n // collapse.\n text = text.replace(/\\s/g, Blockly.Field.NBSP);\n textLines += text;\n if (i !== displayLinesNumber - 1) {\n textLines += '\\n';\n }\n }\n if (block.RTL) {\n // The SVG is LTR, force value to be RTL.\n textLines += '\\u200F';\n }\n return textLines;\n }\n /**\n * Called by setValue if the text input is valid. Updates the value of the\n * field, and updates the text of the field if it is not currently being\n * edited (i.e. handled by the htmlInput_). Is being redefined here to update\n * overflow state of the field.\n *\n * @param newValue The value to be saved. The default validator guarantees\n * that this is a string.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n doValueUpdate_(newValue) {\n super.doValueUpdate_(newValue);\n if (this.value_ !== null) {\n this.isOverflowedY_ = this.value_.split('\\n').length > this.maxLines_;\n }\n }\n /** Updates the text of the textElement. */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n render_() {\n const block = this.getSourceBlock();\n if (!block) {\n throw new Error('The field has not yet been attached to its input. ' +\n 'Call appendField to attach it.');\n }\n // Remove all text group children.\n let currentChild;\n const textGroup = this.textGroup;\n while (currentChild = textGroup.firstChild) {\n textGroup.removeChild(currentChild);\n }\n const constants = this.getConstants();\n // This can't happen, but TypeScript thinks it can and lint forbids `!.`.\n if (!constants)\n throw Error('Constants not found');\n // Add in text elements into the group.\n const lines = this.getDisplayText_().split('\\n');\n let y = 0;\n for (let i = 0; i < lines.length; i++) {\n const lineHeight = constants.FIELD_TEXT_HEIGHT +\n constants.FIELD_BORDER_RECT_Y_PADDING;\n const span = Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.TEXT, {\n 'class': 'blocklyText blocklyMultilineText',\n 'x': constants.FIELD_BORDER_RECT_X_PADDING,\n 'y': y + constants.FIELD_BORDER_RECT_Y_PADDING,\n 'dy': constants.FIELD_TEXT_BASELINE,\n }, textGroup);\n span.appendChild(document.createTextNode(lines[i]));\n y += lineHeight;\n }\n if (this.isBeingEdited_) {\n const htmlInput = this.htmlInput_;\n if (this.isOverflowedY_) {\n Blockly.utils.dom.addClass(htmlInput, 'blocklyHtmlTextAreaInputOverflowedY');\n }\n else {\n Blockly.utils.dom.removeClass(htmlInput, 'blocklyHtmlTextAreaInputOverflowedY');\n }\n }\n this.updateSize_();\n if (this.isBeingEdited_) {\n if (block.RTL) {\n // in RTL, we need to let the browser reflow before resizing\n // in order to get the correct bounding box of the borderRect\n // avoiding issue #2777.\n setTimeout(this.resizeEditor_.bind(this), 0);\n }\n else {\n this.resizeEditor_();\n }\n const htmlInput = this.htmlInput_;\n if (!this.isTextValid_) {\n Blockly.utils.dom.addClass(htmlInput, 'blocklyInvalidInput');\n Blockly.utils.aria.setState(htmlInput, Blockly.utils.aria.State.INVALID, true);\n }\n else {\n Blockly.utils.dom.removeClass(htmlInput, 'blocklyInvalidInput');\n Blockly.utils.aria.setState(htmlInput, Blockly.utils.aria.State.INVALID, false);\n }\n }\n }\n /** Updates the size of the field based on the text. */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n updateSize_() {\n const constants = this.getConstants();\n // This can't happen, but TypeScript thinks it can and lint forbids `!.`.\n if (!constants)\n throw Error('Constants not found');\n const nodes = this.textGroup.childNodes;\n const fontSize = constants.FIELD_TEXT_FONTSIZE;\n const fontWeight = constants.FIELD_TEXT_FONTWEIGHT;\n const fontFamily = constants.FIELD_TEXT_FONTFAMILY;\n let totalWidth = 0;\n let totalHeight = 0;\n for (let i = 0; i < nodes.length; i++) {\n const tspan = nodes[i];\n const textWidth = Blockly.utils.dom.getFastTextWidth(tspan, fontSize, fontWeight, fontFamily);\n if (textWidth > totalWidth) {\n totalWidth = textWidth;\n }\n totalHeight += constants.FIELD_TEXT_HEIGHT +\n (i > 0 ? constants.FIELD_BORDER_RECT_Y_PADDING : 0);\n }\n if (this.isBeingEdited_) {\n // The default width is based on the longest line in the display text,\n // but when it's being edited, width should be calculated based on the\n // absolute longest line, even if it would be truncated after editing.\n // Otherwise we would get wrong editor width when there are more\n // lines than this.maxLines_.\n const actualEditorLines = String(this.value_).split('\\n');\n const dummyTextElement = Blockly.utils.dom.createSvgElement(Blockly.utils.Svg.TEXT, { 'class': 'blocklyText blocklyMultilineText' });\n for (let i = 0; i < actualEditorLines.length; i++) {\n if (actualEditorLines[i].length > this.maxDisplayLength) {\n actualEditorLines[i] =\n actualEditorLines[i].substring(0, this.maxDisplayLength);\n }\n dummyTextElement.textContent = actualEditorLines[i];\n const lineWidth = Blockly.utils.dom.getFastTextWidth(dummyTextElement, fontSize, fontWeight, fontFamily);\n if (lineWidth > totalWidth) {\n totalWidth = lineWidth;\n }\n }\n const htmlInput = this.htmlInput_;\n const scrollbarWidth = htmlInput.offsetWidth - htmlInput.clientWidth;\n totalWidth += scrollbarWidth;\n }\n if (this.borderRect_) {\n totalHeight += constants.FIELD_BORDER_RECT_Y_PADDING * 2;\n totalWidth += constants.FIELD_BORDER_RECT_X_PADDING * 2;\n this.borderRect_.setAttribute('width', `${totalWidth}`);\n this.borderRect_.setAttribute('height', `${totalHeight}`);\n }\n this.size_.width = totalWidth;\n this.size_.height = totalHeight;\n this.positionBorderRect_();\n }\n /**\n * Show the inline free-text editor on top of the text.\n * Overrides the default behaviour to force rerender in order to\n * correct block size, based on editor text.\n *\n * @param e Optional mouse event that triggered the field to open, or\n * undefined if triggered programmatically.\n * @param quietInput True if editor should be created without focus.\n * Defaults to false.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n showEditor_(e, quietInput) {\n super.showEditor_(e, quietInput);\n this.forceRerender();\n }\n /**\n * Create the text input editor widget.\n *\n * @returns The newly created text input editor.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n widgetCreate_() {\n const div = Blockly.WidgetDiv.getDiv();\n const scale = this.workspace_.getScale();\n const constants = this.getConstants();\n // This can't happen, but TypeScript thinks it can and lint forbids `!.`.\n if (!constants)\n throw Error('Constants not found');\n const htmlInput = (document.createElement('textarea'));\n htmlInput.className = 'blocklyHtmlInput blocklyHtmlTextAreaInput';\n htmlInput.setAttribute('spellcheck', String(this.spellcheck_));\n const fontSize = constants.FIELD_TEXT_FONTSIZE * scale + 'pt';\n div.style.fontSize = fontSize;\n htmlInput.style.fontSize = fontSize;\n const borderRadius = Blockly.FieldTextInput.BORDERRADIUS * scale + 'px';\n htmlInput.style.borderRadius = borderRadius;\n const paddingX = constants.FIELD_BORDER_RECT_X_PADDING * scale;\n const paddingY = constants.FIELD_BORDER_RECT_Y_PADDING * scale / 2;\n htmlInput.style.padding = paddingY + 'px ' + paddingX + 'px ' + paddingY +\n 'px ' + paddingX + 'px';\n const lineHeight = constants.FIELD_TEXT_HEIGHT +\n constants.FIELD_BORDER_RECT_Y_PADDING;\n htmlInput.style.lineHeight = lineHeight * scale + 'px';\n div.appendChild(htmlInput);\n htmlInput.value = htmlInput.defaultValue = this.getEditorText_(this.value_);\n htmlInput.setAttribute('data-untyped-default-value', String(this.value_));\n htmlInput.setAttribute('data-old-value', '');\n if (Blockly.utils.userAgent.GECKO) {\n // In FF, ensure the browser reflows before resizing to avoid issue #2777.\n setTimeout(this.resizeEditor_.bind(this), 0);\n }\n else {\n this.resizeEditor_();\n }\n this.bindInputEvents_(htmlInput);\n return htmlInput;\n }\n /**\n * Sets the maxLines config for this field.\n *\n * @param maxLines Defines the maximum number of lines allowed, before\n * scrolling functionality is enabled.\n */\n setMaxLines(maxLines) {\n if (typeof maxLines === 'number' && maxLines > 0 &&\n maxLines !== this.maxLines_) {\n this.maxLines_ = maxLines;\n this.forceRerender();\n }\n }\n /**\n * Returns the maxLines config of this field.\n *\n * @returns The maxLines config value.\n */\n getMaxLines() {\n return this.maxLines_;\n }\n /**\n * Handle key down to the editor. Override the text input definition of this\n * so as to not close the editor when enter is typed in.\n *\n * @param e Keyboard event.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n onHtmlInputKeyDown_(e) {\n if (e.key !== 'Enter') {\n super.onHtmlInputKeyDown_(e);\n }\n }\n /**\n * Construct a FieldMultilineInput from a JSON arg object,\n * dereferencing any string table references.\n *\n * @param options A JSON object with options (text, and spellcheck).\n * @returns The new field instance.\n * @nocollapse\n */\n static fromJson(options) {\n const text = Blockly.utils.parsing.replaceMessageReferences(options.text);\n // `this` might be a subclass of FieldMultilineInput if that class doesn't\n // override the static fromJson method.\n return new this(text, undefined, options);\n }\n}\n// Unregister legacy field_multilinetext that was in core. Delete this once\n// core Blockly no longer defines field_multilinetext.\n// If field_multilinetext is not defined in core,\n// this generates a console warning.\nBlockly.fieldRegistry.unregister('field_multilinetext');\nBlockly.fieldRegistry.register('field_multilinetext', FieldMultilineInput);\n/**\n * CSS for multiline field.\n */\nBlockly.Css.register(`\n.blocklyHtmlTextAreaInput {\n font-family: monospace;\n resize: none;\n overflow: hidden;\n height: 100%;\n text-align: left;\n}\n\n.blocklyHtmlTextAreaInputOverflowedY {\n overflow-y: scroll;\n}\n`);\n"],"names":["root","factory","exports","module","require","define","amd","a","i","this","__WEBPACK_EXTERNAL_MODULE__573__","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","FieldMultilineInput","constructor","validator","config","super","textGroup","maxLines_","Infinity","isOverflowedY_","configure_","setValue","setValidator","maxLines","setMaxLines","toXml","fieldElement","textContent","getValue","replace","fromXml","saveState","legacyState","saveLegacyState","loadState","state","loadLegacyState","initView","createBorderRect_","fieldGroup_","getDisplayText_","block","getSourceBlock","Error","textLines","getText","lines","split","displayLinesNumber","length","text","maxDisplayLength","substring","RTL","doValueUpdate_","newValue","value_","render_","currentChild","firstChild","removeChild","constants","getConstants","y","lineHeight","FIELD_TEXT_HEIGHT","FIELD_BORDER_RECT_Y_PADDING","FIELD_BORDER_RECT_X_PADDING","FIELD_TEXT_BASELINE","appendChild","document","createTextNode","isBeingEdited_","htmlInput","htmlInput_","updateSize_","setTimeout","resizeEditor_","bind","isTextValid_","nodes","childNodes","fontSize","FIELD_TEXT_FONTSIZE","fontWeight","FIELD_TEXT_FONTWEIGHT","fontFamily","FIELD_TEXT_FONTFAMILY","totalWidth","totalHeight","tspan","textWidth","actualEditorLines","String","dummyTextElement","lineWidth","offsetWidth","clientWidth","borderRect_","setAttribute","size_","width","height","positionBorderRect_","showEditor_","e","quietInput","forceRerender","widgetCreate_","div","scale","workspace_","getScale","createElement","className","spellcheck_","style","borderRadius","paddingX","paddingY","padding","defaultValue","getEditorText_","bindInputEvents_","getMaxLines","onHtmlInputKeyDown_","static","options"],"sourceRoot":""}
1
+ {"version":3,"file":"index.js","mappings":";CAAA,SAA2CA,EAAMC,GAChD,GAAsB,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,sBAC7B,GAAqB,mBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,CAAC,gBAAiBJ,OACrB,CACJ,IAAIM,EAAuB,iBAAZL,QAAuBD,EAAQG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Q,KACzDD,EAAIO,MAAMlC,SAAWA,EACrBT,EAAU2C,MAAMlC,SAAWA,EAC3B,MAAMmC,EAAe,8BAAsCP,EAAQ,KACnErC,EAAU2C,MAAMC,aAAeA,EAC/B,MAAMC,EAAWzD,EAAUM,4BAA8B2C,EACnDS,EAAY1D,EAAUK,4BAA8B4C,EAAS,EACnErC,EAAU2C,MAAMI,QACdD,EAAW,MAAQD,EAAW,MAAQC,EAAW,MAAQD,EAAW,KACtE,MAAMtD,EACJH,EAAUI,kBAAoBJ,EAAUK,4BAiB1C,OAhBAO,EAAU2C,MAAMpD,WAAaA,EAAa8C,EAAQ,KAElDD,EAAIxC,YAAYI,GAEhBA,EAAU/D,MAAQ+D,EAAUgD,aAAevI,KAAKwI,eAAexI,KAAKsE,QACpEiB,EAAU0B,aAAa,6BAA8BN,OAAO3G,KAAKsE,SACjEiB,EAAU0B,aAAa,iBAAkB,IACrC,wBAEFvB,WAAW1F,KAAK2F,cAAcC,KAAK5F,MAAO,GAE1CA,KAAK2F,gBAGP3F,KAAKyI,iBAAiBlD,GAEfA,CACT,CAQAjD,YAAYD,GAEY,iBAAbA,GACPA,EAAW,GACXA,IAAarC,KAAK+B,YAElB/B,KAAK+B,UAAYM,EACjBrC,KAAKyH,gBAET,CAOAiB,cACE,OAAO1I,KAAK+B,SACd,CASmB4G,oBAAoBpB,GACvB,UAAVA,EAAE7G,KACJmB,MAAM8G,oBAAoBpB,EAE9B,CAUAqB,gBACEC,GAKA,OAAO,IAAI7I,KAHE,yCAA+C6I,EAAQ7E,WAG9C1D,EAAWuI,EACnC,EAOF,2BAAiC,uBAEjC,yBAA+B,sBAAuBpH,GAKtD,eAAqB","sources":["webpack://@blockly/field-multilineinput/webpack/universalModuleDefinition","webpack://@blockly/field-multilineinput/external umd {\"root\":\"Blockly\",\"commonjs\":\"blockly/core\",\"commonjs2\":\"blockly/core\",\"amd\":\"blockly/core\"}","webpack://@blockly/field-multilineinput/webpack/bootstrap","webpack://@blockly/field-multilineinput/webpack/runtime/define property getters","webpack://@blockly/field-multilineinput/webpack/runtime/hasOwnProperty shorthand","webpack://@blockly/field-multilineinput/webpack/runtime/make namespace object","webpack://@blockly/field-multilineinput/./src/field_multilineinput.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"blockly/core\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"blockly/core\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory(require(\"blockly/core\")) : factory(root[\"Blockly\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, (__WEBPACK_EXTERNAL_MODULE__573__) => {\nreturn ","module.exports = __WEBPACK_EXTERNAL_MODULE__573__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * @license\n * Copyright 2023 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * @fileoverview Multiline text input field.\n */\n\nimport * as Blockly from 'blockly/core';\n\n/**\n * Class for an editable text area input field.\n */\nexport class FieldMultilineInput extends Blockly.FieldTextInput {\n /**\n * The SVG group element that will contain a text element for each text row\n * when initialized.\n */\n textGroup: SVGGElement | null = null;\n\n /**\n * Defines the maximum number of lines of field.\n * If exceeded, scrolling functionality is enabled.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected maxLines_ = Infinity;\n\n /** Whether Y overflow is currently occurring. */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected isOverflowedY_ = false;\n\n /**\n * @param value The initial content of the field. Should cast to a string.\n * Defaults to an empty string if null or undefined. Also accepts\n * Field.SKIP_SETUP if you wish to skip setup (only used by subclasses\n * that want to handle configuration and setting the field value after\n * their own constructors have run).\n * @param validator An optional function that is called to validate any\n * constraints on what the user entered. Takes the new text as an\n * argument and returns either the accepted text, a replacement text, or\n * null to abort the change.\n * @param config A map of options used to configure the field.\n * See the [field creation documentation]{@link\n * https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/multiline-text-input#creation}\n * for a list of properties this parameter supports.\n */\n constructor(\n value?: string | typeof Blockly.Field.SKIP_SETUP,\n validator?: FieldMultilineInputValidator,\n config?: FieldMultilineInputConfig,\n ) {\n super(Blockly.Field.SKIP_SETUP);\n\n if (value === Blockly.Field.SKIP_SETUP) return;\n if (config) {\n this.configure_(config);\n }\n this.setValue(value);\n if (validator) {\n this.setValidator(validator);\n }\n }\n\n /**\n * Configure the field based on the given map of options.\n *\n * @param config A map of options to configure the field based on.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected override configure_(config: FieldMultilineInputConfig) {\n super.configure_(config);\n if (config.maxLines) this.setMaxLines(config.maxLines);\n }\n\n /**\n * Serializes this field's value to XML.\n * Should only be called by Blockly.Xml.\n *\n * @param fieldElement The element to populate with info about the field's\n * state.\n * @returns The element containing info about the field's state.\n */\n override toXml(fieldElement: Element): Element {\n // Replace '\\n' characters with HTML-escaped equivalent '&#10'. This is\n // needed so the plain-text representation of the XML produced by\n // `Blockly.Xml.domToText` will appear on a single line (this is a\n // limitation of the plain-text format).\n fieldElement.textContent = (this.getValue() as string).replace(\n /\\n/g,\n '&#10;',\n );\n return fieldElement;\n }\n\n /**\n * Sets the field's value based on the given XML element. Should only be\n * called by Blockly.Xml.\n *\n * @param fieldElement The element containing info about the field's state.\n */\n override fromXml(fieldElement: Element) {\n this.setValue((fieldElement.textContent as string).replace(/&#10;/g, '\\n'));\n }\n\n /**\n * Saves this field's value.\n * This function only exists for subclasses of FieldMultilineInput which\n * predate the load/saveState API and only define to/fromXml.\n *\n * @returns The state of this field.\n */\n override saveState() {\n const legacyState = this.saveLegacyState(FieldMultilineInput);\n if (legacyState !== null) {\n return legacyState;\n }\n return this.getValue();\n }\n\n /**\n * Sets the field's value based on the given state.\n * This function only exists for subclasses of FieldMultilineInput which\n * predate the load/saveState API and only define to/fromXml.\n *\n * @param state The state of the variable to assign to this variable field.\n */\n override loadState(state: unknown) {\n if (this.loadLegacyState(Blockly.Field, state)) {\n return;\n }\n this.setValue(state);\n }\n\n /**\n * Create the block UI for this field.\n */\n override initView() {\n this.createBorderRect_();\n this.textGroup = Blockly.utils.dom.createSvgElement(\n Blockly.utils.Svg.G,\n {\n 'class': 'blocklyEditableText',\n },\n this.fieldGroup_,\n );\n }\n\n /**\n * Get the text from this field as displayed on screen. May differ from\n * getText due to ellipsis, and other formatting.\n *\n * @returns Currently displayed text.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected override getDisplayText_(): string {\n const block = this.getSourceBlock();\n if (!block) {\n throw new Error(\n 'The field has not yet been attached to its input. ' +\n 'Call appendField to attach it.',\n );\n }\n let textLines = this.getText();\n if (!textLines) {\n // Prevent the field from disappearing if empty.\n return Blockly.Field.NBSP;\n }\n const lines = textLines.split('\\n');\n textLines = '';\n const displayLinesNumber = this.isOverflowedY_\n ? this.maxLines_\n : lines.length;\n for (let i = 0; i < displayLinesNumber; i++) {\n let text = lines[i];\n if (text.length > this.maxDisplayLength) {\n // Truncate displayed string and add an ellipsis ('...').\n text = text.substring(0, this.maxDisplayLength - 4) + '...';\n } else if (this.isOverflowedY_ && i === displayLinesNumber - 1) {\n text = text.substring(0, text.length - 3) + '...';\n }\n // Replace whitespace with non-breaking spaces so the text doesn't\n // collapse.\n text = text.replace(/\\s/g, Blockly.Field.NBSP);\n\n textLines += text;\n if (i !== displayLinesNumber - 1) {\n textLines += '\\n';\n }\n }\n if (block.RTL) {\n // The SVG is LTR, force value to be RTL.\n textLines += '\\u200F';\n }\n return textLines;\n }\n\n /**\n * Called by setValue if the text input is valid. Updates the value of the\n * field, and updates the text of the field if it is not currently being\n * edited (i.e. handled by the htmlInput_). Is being redefined here to update\n * overflow state of the field.\n *\n * @param newValue The value to be saved. The default validator guarantees\n * that this is a string.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected override doValueUpdate_(newValue: string) {\n super.doValueUpdate_(newValue);\n if (this.value_ !== null) {\n this.isOverflowedY_ = this.value_.split('\\n').length > this.maxLines_;\n }\n }\n\n /** Updates the text of the textElement. */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected override render_() {\n const block = this.getSourceBlock();\n if (!block) {\n throw new Error(\n 'The field has not yet been attached to its input. ' +\n 'Call appendField to attach it.',\n );\n }\n // Remove all text group children.\n let currentChild;\n const textGroup = this.textGroup as SVGElement;\n while ((currentChild = textGroup.firstChild)) {\n textGroup.removeChild(currentChild);\n }\n\n const constants = this.getConstants();\n // This can't happen, but TypeScript thinks it can and lint forbids `!.`.\n if (!constants) throw Error('Constants not found');\n // Add in text elements into the group.\n const lines = this.getDisplayText_().split('\\n');\n let y = 0;\n for (let i = 0; i < lines.length; i++) {\n const lineHeight =\n constants.FIELD_TEXT_HEIGHT + constants.FIELD_BORDER_RECT_Y_PADDING;\n const span = Blockly.utils.dom.createSvgElement(\n Blockly.utils.Svg.TEXT,\n {\n 'class': 'blocklyText blocklyMultilineText',\n 'x': constants.FIELD_BORDER_RECT_X_PADDING,\n 'y': y + constants.FIELD_BORDER_RECT_Y_PADDING,\n 'dy': constants.FIELD_TEXT_BASELINE,\n },\n textGroup,\n );\n span.appendChild(document.createTextNode(lines[i]));\n y += lineHeight;\n }\n\n if (this.isBeingEdited_) {\n const htmlInput = this.htmlInput_ as HTMLElement;\n if (this.isOverflowedY_) {\n Blockly.utils.dom.addClass(\n htmlInput,\n 'blocklyHtmlTextAreaInputOverflowedY',\n );\n } else {\n Blockly.utils.dom.removeClass(\n htmlInput,\n 'blocklyHtmlTextAreaInputOverflowedY',\n );\n }\n }\n\n this.updateSize_();\n\n if (this.isBeingEdited_) {\n if (block.RTL) {\n // in RTL, we need to let the browser reflow before resizing\n // in order to get the correct bounding box of the borderRect\n // avoiding issue #2777.\n setTimeout(this.resizeEditor_.bind(this), 0);\n } else {\n this.resizeEditor_();\n }\n const htmlInput = this.htmlInput_ as HTMLElement;\n if (!this.isTextValid_) {\n Blockly.utils.dom.addClass(htmlInput, 'blocklyInvalidInput');\n Blockly.utils.aria.setState(\n htmlInput,\n Blockly.utils.aria.State.INVALID,\n true,\n );\n } else {\n Blockly.utils.dom.removeClass(htmlInput, 'blocklyInvalidInput');\n Blockly.utils.aria.setState(\n htmlInput,\n Blockly.utils.aria.State.INVALID,\n false,\n );\n }\n }\n }\n\n /** Updates the size of the field based on the text. */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected override updateSize_() {\n const constants = this.getConstants();\n // This can't happen, but TypeScript thinks it can and lint forbids `!.`.\n if (!constants) throw Error('Constants not found');\n const nodes = (this.textGroup as SVGElement).childNodes;\n const fontSize = constants.FIELD_TEXT_FONTSIZE;\n const fontWeight = constants.FIELD_TEXT_FONTWEIGHT;\n const fontFamily = constants.FIELD_TEXT_FONTFAMILY;\n let totalWidth = 0;\n let totalHeight = 0;\n for (let i = 0; i < nodes.length; i++) {\n const tspan = nodes[i] as SVGTextElement;\n const textWidth = Blockly.utils.dom.getFastTextWidth(\n tspan,\n fontSize,\n fontWeight,\n fontFamily,\n );\n if (textWidth > totalWidth) {\n totalWidth = textWidth;\n }\n totalHeight +=\n constants.FIELD_TEXT_HEIGHT +\n (i > 0 ? constants.FIELD_BORDER_RECT_Y_PADDING : 0);\n }\n if (this.isBeingEdited_) {\n // The default width is based on the longest line in the display text,\n // but when it's being edited, width should be calculated based on the\n // absolute longest line, even if it would be truncated after editing.\n // Otherwise we would get wrong editor width when there are more\n // lines than this.maxLines_.\n const actualEditorLines = String(this.value_).split('\\n');\n const dummyTextElement = Blockly.utils.dom.createSvgElement(\n Blockly.utils.Svg.TEXT,\n {'class': 'blocklyText blocklyMultilineText'},\n );\n\n for (let i = 0; i < actualEditorLines.length; i++) {\n if (actualEditorLines[i].length > this.maxDisplayLength) {\n actualEditorLines[i] = actualEditorLines[i].substring(\n 0,\n this.maxDisplayLength,\n );\n }\n dummyTextElement.textContent = actualEditorLines[i];\n const lineWidth = Blockly.utils.dom.getFastTextWidth(\n dummyTextElement,\n fontSize,\n fontWeight,\n fontFamily,\n );\n if (lineWidth > totalWidth) {\n totalWidth = lineWidth;\n }\n }\n\n const htmlInput = this.htmlInput_ as HTMLElement;\n const scrollbarWidth = htmlInput.offsetWidth - htmlInput.clientWidth;\n totalWidth += scrollbarWidth;\n }\n if (this.borderRect_) {\n totalHeight += constants.FIELD_BORDER_RECT_Y_PADDING * 2;\n totalWidth += constants.FIELD_BORDER_RECT_X_PADDING * 2;\n this.borderRect_.setAttribute('width', `${totalWidth}`);\n this.borderRect_.setAttribute('height', `${totalHeight}`);\n }\n this.size_.width = totalWidth;\n this.size_.height = totalHeight;\n\n this.positionBorderRect_();\n }\n\n /**\n * Show the inline free-text editor on top of the text.\n * Overrides the default behaviour to force rerender in order to\n * correct block size, based on editor text.\n *\n * @param e Optional mouse event that triggered the field to open, or\n * undefined if triggered programmatically.\n * @param quietInput True if editor should be created without focus.\n * Defaults to false.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n override showEditor_(e?: Event, quietInput?: boolean) {\n super.showEditor_(e, quietInput);\n this.forceRerender();\n }\n\n /**\n * Create the text input editor widget.\n *\n * @returns The newly created text input editor.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected override widgetCreate_(): HTMLTextAreaElement {\n const div = Blockly.WidgetDiv.getDiv() as HTMLDivElement;\n const scale = (this.workspace_ as Blockly.WorkspaceSvg).getScale();\n const constants = this.getConstants();\n // This can't happen, but TypeScript thinks it can and lint forbids `!.`.\n if (!constants) throw Error('Constants not found');\n\n const htmlInput = document.createElement('textarea');\n htmlInput.className = 'blocklyHtmlInput blocklyHtmlTextAreaInput';\n htmlInput.setAttribute('spellcheck', String(this.spellcheck_));\n const fontSize = constants.FIELD_TEXT_FONTSIZE * scale + 'pt';\n div.style.fontSize = fontSize;\n htmlInput.style.fontSize = fontSize;\n const borderRadius = Blockly.FieldTextInput.BORDERRADIUS * scale + 'px';\n htmlInput.style.borderRadius = borderRadius;\n const paddingX = constants.FIELD_BORDER_RECT_X_PADDING * scale;\n const paddingY = (constants.FIELD_BORDER_RECT_Y_PADDING * scale) / 2;\n htmlInput.style.padding =\n paddingY + 'px ' + paddingX + 'px ' + paddingY + 'px ' + paddingX + 'px';\n const lineHeight =\n constants.FIELD_TEXT_HEIGHT + constants.FIELD_BORDER_RECT_Y_PADDING;\n htmlInput.style.lineHeight = lineHeight * scale + 'px';\n\n div.appendChild(htmlInput);\n\n htmlInput.value = htmlInput.defaultValue = this.getEditorText_(this.value_);\n htmlInput.setAttribute('data-untyped-default-value', String(this.value_));\n htmlInput.setAttribute('data-old-value', '');\n if (Blockly.utils.userAgent.GECKO) {\n // In FF, ensure the browser reflows before resizing to avoid issue #2777.\n setTimeout(this.resizeEditor_.bind(this), 0);\n } else {\n this.resizeEditor_();\n }\n\n this.bindInputEvents_(htmlInput);\n\n return htmlInput;\n }\n\n /**\n * Sets the maxLines config for this field.\n *\n * @param maxLines Defines the maximum number of lines allowed, before\n * scrolling functionality is enabled.\n */\n setMaxLines(maxLines: number) {\n if (\n typeof maxLines === 'number' &&\n maxLines > 0 &&\n maxLines !== this.maxLines_\n ) {\n this.maxLines_ = maxLines;\n this.forceRerender();\n }\n }\n\n /**\n * Returns the maxLines config of this field.\n *\n * @returns The maxLines config value.\n */\n getMaxLines(): number {\n return this.maxLines_;\n }\n\n /**\n * Handle key down to the editor. Override the text input definition of this\n * so as to not close the editor when enter is typed in.\n *\n * @param e Keyboard event.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected override onHtmlInputKeyDown_(e: KeyboardEvent) {\n if (e.key !== 'Enter') {\n super.onHtmlInputKeyDown_(e);\n }\n }\n\n /**\n * Construct a FieldMultilineInput from a JSON arg object,\n * dereferencing any string table references.\n *\n * @param options A JSON object with options (text, and spellcheck).\n * @returns The new field instance.\n * @nocollapse\n */\n static override fromJson(\n options: FieldMultilineInputFromJsonConfig,\n ): FieldMultilineInput {\n const text = Blockly.utils.parsing.replaceMessageReferences(options.text);\n // `this` might be a subclass of FieldMultilineInput if that class doesn't\n // override the static fromJson method.\n return new this(text, undefined, options);\n }\n}\n\n// Unregister legacy field_multilinetext that was in core. Delete this once\n// core Blockly no longer defines field_multilinetext.\n// If field_multilinetext is not defined in core,\n// this generates a console warning.\nBlockly.fieldRegistry.unregister('field_multilinetext');\n\nBlockly.fieldRegistry.register('field_multilinetext', FieldMultilineInput);\n\n/**\n * CSS for multiline field.\n */\nBlockly.Css.register(`\n.blocklyHtmlTextAreaInput {\n font-family: monospace;\n resize: none;\n overflow: hidden;\n height: 100%;\n text-align: left;\n}\n\n.blocklyHtmlTextAreaInputOverflowedY {\n overflow-y: scroll;\n}\n`);\n\n/**\n * Config options for the multiline input field.\n */\nexport interface FieldMultilineInputConfig\n extends Blockly.FieldTextInputConfig {\n maxLines?: number;\n}\n\n/**\n * fromJson config options for the multiline input field.\n */\nexport interface FieldMultilineInputFromJsonConfig\n extends FieldMultilineInputConfig {\n text?: string;\n}\n\n/**\n * A function that is called to validate changes to the field's value before\n * they are set.\n *\n * @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values}\n * @param newValue The value to be validated.\n * @returns One of three instructions for setting the new value: `T`, `null`,\n * or `undefined`.\n *\n * - `T` to set this function's returned value instead of `newValue`.\n *\n * - `null` to invoke `doValueInvalid_` and not set a value.\n *\n * - `undefined` to set `newValue` as is.\n */\nexport type FieldMultilineInputValidator = Blockly.FieldTextInputValidator;\n"],"names":["root","factory","exports","module","require","define","amd","a","i","this","__WEBPACK_EXTERNAL_MODULE__573__","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","FieldMultilineInput","constructor","validator","config","super","textGroup","maxLines_","Infinity","isOverflowedY_","configure_","setValue","setValidator","maxLines","setMaxLines","toXml","fieldElement","textContent","getValue","replace","fromXml","saveState","legacyState","saveLegacyState","loadState","state","loadLegacyState","initView","createBorderRect_","fieldGroup_","getDisplayText_","block","getSourceBlock","Error","textLines","getText","lines","split","displayLinesNumber","length","text","maxDisplayLength","substring","RTL","doValueUpdate_","newValue","value_","render_","currentChild","firstChild","removeChild","constants","getConstants","y","lineHeight","FIELD_TEXT_HEIGHT","FIELD_BORDER_RECT_Y_PADDING","FIELD_BORDER_RECT_X_PADDING","FIELD_TEXT_BASELINE","appendChild","document","createTextNode","isBeingEdited_","htmlInput","htmlInput_","updateSize_","setTimeout","resizeEditor_","bind","isTextValid_","nodes","childNodes","fontSize","FIELD_TEXT_FONTSIZE","fontWeight","FIELD_TEXT_FONTWEIGHT","fontFamily","FIELD_TEXT_FONTFAMILY","totalWidth","totalHeight","tspan","textWidth","actualEditorLines","String","dummyTextElement","lineWidth","offsetWidth","clientWidth","borderRect_","setAttribute","size_","width","height","positionBorderRect_","showEditor_","e","quietInput","forceRerender","widgetCreate_","div","scale","workspace_","getScale","createElement","className","spellcheck_","style","borderRadius","paddingX","paddingY","padding","defaultValue","getEditorText_","bindInputEvents_","getMaxLines","onHtmlInputKeyDown_","static","options"],"sourceRoot":""}
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@blockly/field-multilineinput",
3
- "version": "3.0.6",
3
+ "version": "3.0.7",
4
4
  "description": "A Blockly multilineinput field.",
5
5
  "scripts": {
6
6
  "audit:fix": "blockly-scripts auditFix",
7
7
  "build": "blockly-scripts build",
8
8
  "clean": "blockly-scripts clean",
9
- "lint": "blockly-scripts lint",
9
+ "lint": "eslint .",
10
10
  "predeploy": "blockly-scripts predeploy",
11
11
  "prepublishOnly": "npm run clean && npm run build",
12
12
  "start": "blockly-scripts start",
13
13
  "test": "blockly-scripts test"
14
14
  },
15
15
  "main": "./dist/index.js",
16
- "module": "./src/index.js",
16
+ "types": "./dist/index.d.ts",
17
17
  "unpkg": "./dist/index.js",
18
18
  "author": "Blockly Team",
19
19
  "keywords": [
@@ -40,9 +40,8 @@
40
40
  "src"
41
41
  ],
42
42
  "devDependencies": {
43
- "@blockly/dev-scripts": "^2.0.1",
44
- "@blockly/dev-tools": "^7.1.0",
45
- "@typescript-eslint/parser": "^5.59.5",
43
+ "@blockly/dev-scripts": "^2.0.2",
44
+ "@blockly/dev-tools": "^7.1.1",
46
45
  "blockly": "^10.0.0",
47
46
  "chai": "^4.2.0",
48
47
  "sinon": "^9.0.1",
@@ -55,11 +54,8 @@
55
54
  "access": "public",
56
55
  "registry": "https://wombat-dressing-room.appspot.com"
57
56
  },
58
- "eslintConfig": {
59
- "extends": "@blockly/eslint-config"
60
- },
61
57
  "engines": {
62
58
  "node": ">=8.0.0"
63
59
  },
64
- "gitHead": "9aa7cd200a6b1a396b5b3b908c7b9d574ddf8805"
60
+ "gitHead": "defd5f8e3621403beb8e2ade3279b26268ae013c"
65
61
  }
@@ -10,7 +10,6 @@
10
10
 
11
11
  import * as Blockly from 'blockly/core';
12
12
 
13
-
14
13
  /**
15
14
  * Class for an editable text area input field.
16
15
  */
@@ -19,7 +18,7 @@ export class FieldMultilineInput extends Blockly.FieldTextInput {
19
18
  * The SVG group element that will contain a text element for each text row
20
19
  * when initialized.
21
20
  */
22
- textGroup: SVGGElement|null = null;
21
+ textGroup: SVGGElement | null = null;
23
22
 
24
23
  /**
25
24
  * Defines the maximum number of lines of field.
@@ -48,9 +47,10 @@ export class FieldMultilineInput extends Blockly.FieldTextInput {
48
47
  * for a list of properties this parameter supports.
49
48
  */
50
49
  constructor(
51
- value?: string|typeof Blockly.Field.SKIP_SETUP,
52
- validator?: FieldMultilineInputValidator,
53
- config?: FieldMultilineInputConfig) {
50
+ value?: string | typeof Blockly.Field.SKIP_SETUP,
51
+ validator?: FieldMultilineInputValidator,
52
+ config?: FieldMultilineInputConfig,
53
+ ) {
54
54
  super(Blockly.Field.SKIP_SETUP);
55
55
 
56
56
  if (value === Blockly.Field.SKIP_SETUP) return;
@@ -87,8 +87,10 @@ export class FieldMultilineInput extends Blockly.FieldTextInput {
87
87
  // needed so the plain-text representation of the XML produced by
88
88
  // `Blockly.Xml.domToText` will appear on a single line (this is a
89
89
  // limitation of the plain-text format).
90
- fieldElement.textContent =
91
- (this.getValue() as string).replace(/\n/g, '&#10;');
90
+ fieldElement.textContent = (this.getValue() as string).replace(
91
+ /\n/g,
92
+ '&#10;',
93
+ );
92
94
  return fieldElement;
93
95
  }
94
96
 
@@ -137,10 +139,12 @@ export class FieldMultilineInput extends Blockly.FieldTextInput {
137
139
  override initView() {
138
140
  this.createBorderRect_();
139
141
  this.textGroup = Blockly.utils.dom.createSvgElement(
140
- Blockly.utils.Svg.G, {
141
- 'class': 'blocklyEditableText',
142
- },
143
- this.fieldGroup_);
142
+ Blockly.utils.Svg.G,
143
+ {
144
+ 'class': 'blocklyEditableText',
145
+ },
146
+ this.fieldGroup_,
147
+ );
144
148
  }
145
149
 
146
150
  /**
@@ -153,8 +157,10 @@ export class FieldMultilineInput extends Blockly.FieldTextInput {
153
157
  protected override getDisplayText_(): string {
154
158
  const block = this.getSourceBlock();
155
159
  if (!block) {
156
- throw new Error('The field has not yet been attached to its input. ' +
157
- 'Call appendField to attach it.');
160
+ throw new Error(
161
+ 'The field has not yet been attached to its input. ' +
162
+ 'Call appendField to attach it.',
163
+ );
158
164
  }
159
165
  let textLines = this.getText();
160
166
  if (!textLines) {
@@ -163,8 +169,9 @@ export class FieldMultilineInput extends Blockly.FieldTextInput {
163
169
  }
164
170
  const lines = textLines.split('\n');
165
171
  textLines = '';
166
- const displayLinesNumber =
167
- this.isOverflowedY_ ? this.maxLines_ : lines.length;
172
+ const displayLinesNumber = this.isOverflowedY_
173
+ ? this.maxLines_
174
+ : lines.length;
168
175
  for (let i = 0; i < displayLinesNumber; i++) {
169
176
  let text = lines[i];
170
177
  if (text.length > this.maxDisplayLength) {
@@ -211,13 +218,15 @@ export class FieldMultilineInput extends Blockly.FieldTextInput {
211
218
  protected override render_() {
212
219
  const block = this.getSourceBlock();
213
220
  if (!block) {
214
- throw new Error('The field has not yet been attached to its input. ' +
215
- 'Call appendField to attach it.');
221
+ throw new Error(
222
+ 'The field has not yet been attached to its input. ' +
223
+ 'Call appendField to attach it.',
224
+ );
216
225
  }
217
226
  // Remove all text group children.
218
227
  let currentChild;
219
228
  const textGroup = this.textGroup as SVGElement;
220
- while (currentChild = textGroup.firstChild) {
229
+ while ((currentChild = textGroup.firstChild)) {
221
230
  textGroup.removeChild(currentChild);
222
231
  }
223
232
 
@@ -228,16 +237,18 @@ export class FieldMultilineInput extends Blockly.FieldTextInput {
228
237
  const lines = this.getDisplayText_().split('\n');
229
238
  let y = 0;
230
239
  for (let i = 0; i < lines.length; i++) {
231
- const lineHeight = constants.FIELD_TEXT_HEIGHT +
232
- constants.FIELD_BORDER_RECT_Y_PADDING;
240
+ const lineHeight =
241
+ constants.FIELD_TEXT_HEIGHT + constants.FIELD_BORDER_RECT_Y_PADDING;
233
242
  const span = Blockly.utils.dom.createSvgElement(
234
- Blockly.utils.Svg.TEXT, {
235
- 'class': 'blocklyText blocklyMultilineText',
236
- 'x': constants.FIELD_BORDER_RECT_X_PADDING,
237
- 'y': y + constants.FIELD_BORDER_RECT_Y_PADDING,
238
- 'dy': constants.FIELD_TEXT_BASELINE,
239
- },
240
- textGroup);
243
+ Blockly.utils.Svg.TEXT,
244
+ {
245
+ 'class': 'blocklyText blocklyMultilineText',
246
+ 'x': constants.FIELD_BORDER_RECT_X_PADDING,
247
+ 'y': y + constants.FIELD_BORDER_RECT_Y_PADDING,
248
+ 'dy': constants.FIELD_TEXT_BASELINE,
249
+ },
250
+ textGroup,
251
+ );
241
252
  span.appendChild(document.createTextNode(lines[i]));
242
253
  y += lineHeight;
243
254
  }
@@ -245,11 +256,15 @@ export class FieldMultilineInput extends Blockly.FieldTextInput {
245
256
  if (this.isBeingEdited_) {
246
257
  const htmlInput = this.htmlInput_ as HTMLElement;
247
258
  if (this.isOverflowedY_) {
248
- Blockly.utils.dom.addClass(htmlInput,
249
- 'blocklyHtmlTextAreaInputOverflowedY');
259
+ Blockly.utils.dom.addClass(
260
+ htmlInput,
261
+ 'blocklyHtmlTextAreaInputOverflowedY',
262
+ );
250
263
  } else {
251
- Blockly.utils.dom.removeClass(htmlInput,
252
- 'blocklyHtmlTextAreaInputOverflowedY');
264
+ Blockly.utils.dom.removeClass(
265
+ htmlInput,
266
+ 'blocklyHtmlTextAreaInputOverflowedY',
267
+ );
253
268
  }
254
269
  }
255
270
 
@@ -267,12 +282,18 @@ export class FieldMultilineInput extends Blockly.FieldTextInput {
267
282
  const htmlInput = this.htmlInput_ as HTMLElement;
268
283
  if (!this.isTextValid_) {
269
284
  Blockly.utils.dom.addClass(htmlInput, 'blocklyInvalidInput');
270
- Blockly.utils.aria.setState(htmlInput, Blockly.utils.aria.State.INVALID,
271
- true);
285
+ Blockly.utils.aria.setState(
286
+ htmlInput,
287
+ Blockly.utils.aria.State.INVALID,
288
+ true,
289
+ );
272
290
  } else {
273
291
  Blockly.utils.dom.removeClass(htmlInput, 'blocklyInvalidInput');
274
- Blockly.utils.aria.setState(htmlInput, Blockly.utils.aria.State.INVALID,
275
- false);
292
+ Blockly.utils.aria.setState(
293
+ htmlInput,
294
+ Blockly.utils.aria.State.INVALID,
295
+ false,
296
+ );
276
297
  }
277
298
  }
278
299
  }
@@ -292,12 +313,17 @@ export class FieldMultilineInput extends Blockly.FieldTextInput {
292
313
  for (let i = 0; i < nodes.length; i++) {
293
314
  const tspan = nodes[i] as SVGTextElement;
294
315
  const textWidth = Blockly.utils.dom.getFastTextWidth(
295
- tspan, fontSize, fontWeight, fontFamily);
316
+ tspan,
317
+ fontSize,
318
+ fontWeight,
319
+ fontFamily,
320
+ );
296
321
  if (textWidth > totalWidth) {
297
322
  totalWidth = textWidth;
298
323
  }
299
- totalHeight += constants.FIELD_TEXT_HEIGHT +
300
- (i > 0 ? constants.FIELD_BORDER_RECT_Y_PADDING : 0);
324
+ totalHeight +=
325
+ constants.FIELD_TEXT_HEIGHT +
326
+ (i > 0 ? constants.FIELD_BORDER_RECT_Y_PADDING : 0);
301
327
  }
302
328
  if (this.isBeingEdited_) {
303
329
  // The default width is based on the longest line in the display text,
@@ -307,17 +333,24 @@ export class FieldMultilineInput extends Blockly.FieldTextInput {
307
333
  // lines than this.maxLines_.
308
334
  const actualEditorLines = String(this.value_).split('\n');
309
335
  const dummyTextElement = Blockly.utils.dom.createSvgElement(
310
- Blockly.utils.Svg.TEXT,
311
- {'class': 'blocklyText blocklyMultilineText'});
336
+ Blockly.utils.Svg.TEXT,
337
+ {'class': 'blocklyText blocklyMultilineText'},
338
+ );
312
339
 
313
340
  for (let i = 0; i < actualEditorLines.length; i++) {
314
341
  if (actualEditorLines[i].length > this.maxDisplayLength) {
315
- actualEditorLines[i] =
316
- actualEditorLines[i].substring(0, this.maxDisplayLength);
342
+ actualEditorLines[i] = actualEditorLines[i].substring(
343
+ 0,
344
+ this.maxDisplayLength,
345
+ );
317
346
  }
318
347
  dummyTextElement.textContent = actualEditorLines[i];
319
348
  const lineWidth = Blockly.utils.dom.getFastTextWidth(
320
- dummyTextElement, fontSize, fontWeight, fontFamily);
349
+ dummyTextElement,
350
+ fontSize,
351
+ fontWeight,
352
+ fontFamily,
353
+ );
321
354
  if (lineWidth > totalWidth) {
322
355
  totalWidth = lineWidth;
323
356
  }
@@ -368,7 +401,7 @@ export class FieldMultilineInput extends Blockly.FieldTextInput {
368
401
  // This can't happen, but TypeScript thinks it can and lint forbids `!.`.
369
402
  if (!constants) throw Error('Constants not found');
370
403
 
371
- const htmlInput = (document.createElement('textarea'));
404
+ const htmlInput = document.createElement('textarea');
372
405
  htmlInput.className = 'blocklyHtmlInput blocklyHtmlTextAreaInput';
373
406
  htmlInput.setAttribute('spellcheck', String(this.spellcheck_));
374
407
  const fontSize = constants.FIELD_TEXT_FONTSIZE * scale + 'pt';
@@ -377,11 +410,11 @@ export class FieldMultilineInput extends Blockly.FieldTextInput {
377
410
  const borderRadius = Blockly.FieldTextInput.BORDERRADIUS * scale + 'px';
378
411
  htmlInput.style.borderRadius = borderRadius;
379
412
  const paddingX = constants.FIELD_BORDER_RECT_X_PADDING * scale;
380
- const paddingY = constants.FIELD_BORDER_RECT_Y_PADDING * scale / 2;
381
- htmlInput.style.padding = paddingY + 'px ' + paddingX + 'px ' + paddingY +
382
- 'px ' + paddingX + 'px';
383
- const lineHeight = constants.FIELD_TEXT_HEIGHT +
384
- constants.FIELD_BORDER_RECT_Y_PADDING;
413
+ const paddingY = (constants.FIELD_BORDER_RECT_Y_PADDING * scale) / 2;
414
+ htmlInput.style.padding =
415
+ paddingY + 'px ' + paddingX + 'px ' + paddingY + 'px ' + paddingX + 'px';
416
+ const lineHeight =
417
+ constants.FIELD_TEXT_HEIGHT + constants.FIELD_BORDER_RECT_Y_PADDING;
385
418
  htmlInput.style.lineHeight = lineHeight * scale + 'px';
386
419
 
387
420
  div.appendChild(htmlInput);
@@ -408,8 +441,11 @@ export class FieldMultilineInput extends Blockly.FieldTextInput {
408
441
  * scrolling functionality is enabled.
409
442
  */
410
443
  setMaxLines(maxLines: number) {
411
- if (typeof maxLines === 'number' && maxLines > 0 &&
412
- maxLines !== this.maxLines_) {
444
+ if (
445
+ typeof maxLines === 'number' &&
446
+ maxLines > 0 &&
447
+ maxLines !== this.maxLines_
448
+ ) {
413
449
  this.maxLines_ = maxLines;
414
450
  this.forceRerender();
415
451
  }
@@ -445,8 +481,9 @@ export class FieldMultilineInput extends Blockly.FieldTextInput {
445
481
  * @returns The new field instance.
446
482
  * @nocollapse
447
483
  */
448
- static override fromJson(options: FieldMultilineInputFromJsonConfig):
449
- FieldMultilineInput {
484
+ static override fromJson(
485
+ options: FieldMultilineInputFromJsonConfig,
486
+ ): FieldMultilineInput {
450
487
  const text = Blockly.utils.parsing.replaceMessageReferences(options.text);
451
488
  // `this` might be a subclass of FieldMultilineInput if that class doesn't
452
489
  // override the static fromJson method.
@@ -462,7 +499,6 @@ Blockly.fieldRegistry.unregister('field_multilinetext');
462
499
 
463
500
  Blockly.fieldRegistry.register('field_multilinetext', FieldMultilineInput);
464
501
 
465
-
466
502
  /**
467
503
  * CSS for multiline field.
468
504
  */
@@ -483,16 +519,16 @@ Blockly.Css.register(`
483
519
  /**
484
520
  * Config options for the multiline input field.
485
521
  */
486
- export interface FieldMultilineInputConfig extends
487
- Blockly.FieldTextInputConfig {
522
+ export interface FieldMultilineInputConfig
523
+ extends Blockly.FieldTextInputConfig {
488
524
  maxLines?: number;
489
525
  }
490
526
 
491
527
  /**
492
528
  * fromJson config options for the multiline input field.
493
529
  */
494
- export interface FieldMultilineInputFromJsonConfig extends
495
- FieldMultilineInputConfig {
530
+ export interface FieldMultilineInputFromJsonConfig
531
+ extends FieldMultilineInputConfig {
496
532
  text?: string;
497
533
  }
498
534