如何禁用文本框中文本的编辑,但仍然可以选择它。面料1.6

时间:2015-10-19 13:17:15

标签: fabricjs

我希望用户能够选择fabric.Textbox并进行旋转,移动,调整大小等但不能编辑文本。要编辑文本,用户必须选择文本框对象,然后激活短信(不在结构中)。 所以我想要的是避免用户可以编辑结构中的文本(如fabric.Text)。 有没有办法做到这一点?

2 个答案:

答案 0 :(得分:6)



canvas = new fabric.Canvas('canvas');
var shape = new fabric.Textbox('i m an not editable textbox', {width: 200, top:0, left:0, editable: false, cursorWidth: 0});
canvas.add(shape);

<script src="http://www.deltalink.it/andreab/fabric/fabric.js"></script>
<canvas id='canvas' width="500" height="400" style="border:#000 1px solid;"></canvas>
&#13;
&#13;
&#13;

fabricjs Textbox子类itext。 从iText文档中可以看到:

/**
 * Indicates whether a text can be edited
 * @type Boolean
 * @default
 */
editable: true,

为什么te游标仍然出现对我来说是个谜。所以我应用了cursorWidth = 0来临时修补问题。 可能是图书馆本身的一个问题。

答案 1 :(得分:3)

SELECT '1' as EntityID, '2018-01-01' as deployed, 'app' as type FROM DUAL UNION ALL
SELECT '2' as EntityID, '2018-02-02' as deployed, 'app' as type FROM DUAL