跳到主要内容

OnDropEvent

实现外部拖放模拟。

语法

expression.OnDropEvent(obj);

expression - 表示 Api 类的变量。

参数

名称必需/可选数据类型默认值描述
obj必需object拖放模拟属性。
obj.type必需string拖放事件类型:onbeforedrop - 当选定的文本或元素被拖动时触发的事件;ondrop - 当选定的文本或元素被放置到有效的放置目标上时触发的事件。
obj.x必需number鼠标点击时相对于整个文档左边缘的水平坐标(以像素为单位)。
obj.y必需number鼠标点击时相对于整个文档顶部边缘的垂直坐标(以像素为单位)。
obj.html必需string被拖动的 HTML 元素。
obj.text必需string被拖动的文本。

返回值

此方法不返回任何数据。

示例

window.Asc.plugin.executeMethod ("OnDropEvent", [{
"type": "onbeforedrop",
"x" : pos.x,
"y" : pos.y
}]);

window.Asc.plugin.executeMethod ("OnDropEvent", [{
"type": "ondrop",
"x" : pos.x,
"y" : pos.y,
"text" : "test text",
"html" : "<span>test html</span>"
}]);