Skip to content

executeInsertElementList rowFlex option not working #1311

@JoaoPedroPerico

Description

@JoaoPedroPerico

version

0.9.119

Link to minimal reproduction

No response

Steps to reproduce

  1. Went to https://hufe.club/canvas-editor/
  2. Cleaned the page content
  3. On console tried to use the following command to insert lines of text
editor.command.executeInsertElementList([
    {
        type: "text",
        bold: true,
        color: "rgb(0, 0, 0)",
        rowFlex: "center",
        value: "Centered test value"
    },
    {
        type: "text",
        bold: true,
        color: "rgb(0, 0, 0)",
        rowFlex: "left",
        value: "\nSecond line, left"
    }]);

What is expected?

I expected the result to be as the following pic

Image

To get this I used the command

editor.command.executeAppendElementList([
    {
        type: "text",
        bold: true,
        color: "rgb(0, 0, 0)",
        rowFlex: "center",
        value: "Centered test value"
    },
    {
        type: "text",
        bold: true,
        color: "rgb(0, 0, 0)",
        rowFlex: "left",
        value: "\nSecond line, left"
    }]);

What is actually happening?

When using executeInsertElementList it dosn't seem to follow my rowFlex value

Image

Editor Value

{
    "version": "0.9.119",
    "data": {
        "header": [
            {
                "value": "第一人民医院",
                "size": 32,
                "rowFlex": "center"
            },
            {
                "value": "\n门诊病历",
                "size": 18,
                "rowFlex": "center"
            },
            {
                "value": "\n",
                "type": "separator",
                "width": 554
            }
        ],
        "main": [
            {
                "value": "Centered test value\nSecond line, left\nCentered test value\nSecond line, left",
                "type": "text",
                "bold": true,
                "color": "rgb(0, 0, 0)"
            }
        ],
        "footer": [
            {
                "value": "canvas-editor",
                "size": 12
            }
        ]
    },
    "options": {
        "mode": "edit",
        "locale": "zhCN",
        "defaultType": "TEXT",
        "defaultColor": "#000000",
        "defaultFont": "Microsoft YaHei",
        "defaultSize": 16,
        "minSize": 5,
        "maxSize": 72,
        "defaultRowMargin": 1,
        "defaultBasicRowMarginHeight": 8,
        "defaultTabWidth": 32,
        "width": 794,
        "height": 1123,
        "scale": 1,
        "pageGap": 20,
        "underlineColor": "#000000",
        "strikeoutColor": "#FF0000",
        "rangeAlpha": 0.6,
        "rangeColor": "#AECBFA",
        "rangeMinWidth": 5,
        "searchMatchAlpha": 0.6,
        "searchMatchColor": "#FFFF00",
        "searchNavigateMatchColor": "#AAD280",
        "highlightAlpha": 0.6,
        "highlightMarginHeight": 8,
        "resizerColor": "#4182D9",
        "resizerSize": 5,
        "marginIndicatorSize": 35,
        "marginIndicatorColor": "#BABABA",
        "margins": [
            100,
            120,
            100,
            120
        ],
        "pageMode": "paging",
        "renderMode": "speed",
        "defaultHyperlinkColor": "#0000FF",
        "paperDirection": "vertical",
        "inactiveAlpha": 0.6,
        "historyMaxRecordCount": 100,
        "wordBreak": "break-word",
        "printPixelRatio": 3,
        "maskMargin": [
            60,
            0,
            30,
            0
        ],
        "letterClass": [
            "A-Za-z"
        ],
        "contextMenuDisableKeys": [],
        "shortcutDisableKeys": [],
        "scrollContainerSelector": "",
        "pageOuterSelectionDisable": false,
        "watermark": {
            "data": "CANVAS-EDITOR",
            "type": "text",
            "width": 0,
            "height": 0,
            "color": "#AEB5C0",
            "opacity": 0.3,
            "size": 120,
            "font": "Microsoft YaHei",
            "repeat": false,
            "gap": [
                10,
                10
            ],
            "numberType": "arabic"
        },
        "pageNumber": {
            "bottom": 60,
            "size": 12,
            "font": "Microsoft YaHei",
            "color": "#000000",
            "rowFlex": "center",
            "format": "第{pageNo}页/共{pageCount}页",
            "numberType": "arabic",
            "disabled": false,
            "startPageNo": 1,
            "fromPageNo": 0,
            "maxPageNo": null
        },
        "placeholder": {
            "data": "请输入正文",
            "color": "#DCDFE6",
            "opacity": 1,
            "size": 16,
            "font": "Microsoft YaHei"
        },
        "zone": {
            "tipDisabled": false
        },
        "table": {
            "tdPadding": [
                0,
                5,
                5,
                5
            ],
            "defaultTrMinHeight": 42,
            "defaultColMinWidth": 40,
            "defaultBorderColor": "#000000",
            "overflow": true
        },
        "header": {
            "top": 30,
            "inactiveAlpha": 1,
            "maxHeightRadio": "half",
            "disabled": false,
            "editable": true
        },
        "footer": {
            "bottom": 30,
            "inactiveAlpha": 1,
            "maxHeightRadio": "half",
            "disabled": false,
            "editable": true
        },
        "control": {
            "placeholderColor": "#9c9b9b",
            "bracketColor": "#000000",
            "prefix": "{",
            "postfix": "}",
            "borderWidth": 1,
            "borderColor": "#000000",
            "activeBackgroundColor": "",
            "disabledBackgroundColor": "",
            "existValueBackgroundColor": "",
            "noValueBackgroundColor": ""
        },
        "checkbox": {
            "width": 14,
            "height": 14,
            "gap": 5,
            "lineWidth": 1,
            "fillStyle": "#5175f4",
            "strokeStyle": "#ffffff",
            "verticalAlign": "bottom"
        },
        "radio": {
            "width": 14,
            "height": 14,
            "gap": 5,
            "lineWidth": 1,
            "fillStyle": "#5175f4",
            "strokeStyle": "#000000",
            "verticalAlign": "bottom"
        },
        "cursor": {
            "width": 1,
            "color": "#000000",
            "dragWidth": 2,
            "dragColor": "#0000FF",
            "dragFloatImageDisabled": false
        },
        "title": {
            "defaultFirstSize": 26,
            "defaultSecondSize": 24,
            "defaultThirdSize": 22,
            "defaultFourthSize": 20,
            "defaultFifthSize": 18,
            "defaultSixthSize": 16
        },
        "group": {
            "opacity": 0.1,
            "backgroundColor": "#E99D00",
            "activeOpacity": 0.5,
            "activeBackgroundColor": "#E99D00",
            "disabled": false,
            "deletable": true
        },
        "pageBreak": {
            "font": "Microsoft YaHei",
            "fontSize": 12,
            "lineDash": [
                3,
                1
            ]
        },
        "background": {
            "color": "#FFFFFF",
            "image": "",
            "size": "cover",
            "repeat": "no-repeat",
            "applyPageNumbers": []
        },
        "lineBreak": {
            "disabled": true,
            "color": "#CCCCCC",
            "lineWidth": 1.5
        },
        "separator": {
            "lineWidth": 1,
            "strokeStyle": "#000000"
        },
        "lineNumber": {
            "size": 12,
            "font": "Microsoft YaHei",
            "color": "#000000",
            "disabled": true,
            "right": 20,
            "type": "continuity"
        },
        "pageBorder": {
            "color": "#000000",
            "lineWidth": 1,
            "padding": [
                0,
                5,
                0,
                5
            ],
            "disabled": true
        },
        "badge": {
            "top": 0,
            "left": 5
        },
        "modeRule": {
            "print": {
                "imagePreviewerDisabled": false
            },
            "readonly": {
                "imagePreviewerDisabled": false
            },
            "form": {
                "controlDeletableDisabled": false
            }
        }
    }
}

System Info

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions