添加画布粘贴外部文字和图片
This commit is contained in:
@@ -321,6 +321,7 @@ export class CreateTextCommand extends Command {
|
||||
this.x = options.x;
|
||||
this.y = options.y;
|
||||
this.textOptions = options.textOptions || {};
|
||||
this.options = options;
|
||||
// 生成唯一ID
|
||||
this.textId = options?.textId || generateId("text_");
|
||||
this.layerId = options?.layerId || generateId("text_layer_");
|
||||
@@ -331,7 +332,7 @@ export class CreateTextCommand extends Command {
|
||||
|
||||
// 默认文本属性
|
||||
this.defaultOptions = {
|
||||
text: t('Canvas.DoubleClickText'),
|
||||
text: options.text || t('Canvas.DoubleClickText'),
|
||||
fontFamily: "Arial",
|
||||
fontSize: 24,
|
||||
fontWeight: "normal",
|
||||
@@ -373,8 +374,8 @@ export class CreateTextCommand extends Command {
|
||||
originY: "center",
|
||||
});
|
||||
|
||||
// 创建文本图层
|
||||
const layerName = this.textOptions.layerName || "文本图层";
|
||||
// 创建文本图层 取15
|
||||
const layerName = this.options.text?.substring(0, 25) || t('Canvas.TextLayer');
|
||||
const layer = createLayer({
|
||||
id: this.layerId,
|
||||
name: layerName,
|
||||
|
||||
Reference in New Issue
Block a user