本帖最后由 Richard.Huang 于 2023-11-23 14:00 编辑
产品:SpreadJS
版本:V14
参考:https://gcdn.grapecity.com.cn/showtopic-146524-1-1.html
- GC.Spread.Sheets.Designer.wrapper.spread.bind(
- GC.Spread.Sheets.Events.EditEnding,
- function (sender, args) {
- window.globalSelectJson = {};
- if (window.getSelection) {
- //一般浏览器
- var userSelection = window.getSelection();
- var userSelectionx = userSelection.toString();
- // 整个文本
- var text = userSelection.anchorNode.textContent;
- // 起点
- var anchor = userSelection.anchorOffset;
- // 终点
- var focus = userSelection.focusOffset; //extentOffset
- var length = text.length;
- if (anchor > focus) {
- anchor += focus;
- focus = anchor - focus;
- anchor -= focus;
- }
- window.globalSelectJson = {
- text: text,
- anchor: anchor,
- focus: focus,
- length: length,
- };
- }
- }
- );
复制代码
问题:这种自动换行里面预期应该拿到单元格所有的文本,现在只拿到了光标所在行的文本,怎么解决?
|
|