You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have used the search tool and did not find an issue describing my bug.
Operating System of DocumentServer
Docker
Version information
8.2.1
Expected Behavior
A new range on intersection or 'null' when nothing intersects.
Actual Behavior
An exception:
TypeError: a is undefined
Li https://example.com/8.2.1-0ace3c53c3b52a07b1bf4ca239d5162e/sdkjs/word/sdk-all.js:10461
nsg https://example.com/8.2.1-0ace3c53c3b52a07b1bf4ca239d5162e/sdkjs/word/sdk-all.js:14003
partOf https://example.com/8.2.1-0ace3c53c3b52a07b1bf4ca239d5162e/sdkjs/word/sdk-all-min.js line 1229 > Function line 3 > eval:15
<anonymous> https://example.com/8.2.1-0ace3c53c3b52a07b1bf4ca239d5162e/sdkjs/word/sdk-all-min.js line 1229 > Function line 3 > eval:81
<anonymous> https://example.com/8.2.1-0ace3c53c3b52a07b1bf4ca239d5162e/sdkjs/word/sdk-all-min.js line 1229 > Function line 3 > eval:97
anonymous https://example.com/8.2.1-0ace3c53c3b52a07b1bf4ca239d5162e/sdkjs/word/sdk-all-min.js line 1229 > Function:3
EDc https://example.com/8.2.1-0ace3c53c3b52a07b1bf4ca239d5162e/sdkjs/word/sdk-all-min.js:1230
Mhf https://example.com/8.2.1-0ace3c53c3b52a07b1bf4ca239d5162e/sdkjs/word/sdk-all.js:14984
Qzh https://example.com/8.2.1-0ace3c53c3b52a07b1bf4ca239d5162e/sdkjs/word/sdk-all.js:14983
h https://example.com/8.2.1-0ace3c53c3b52a07b1bf4ca239d5162e/sdkjs/word/sdk-all.js:14956
EventListener.handleEvent* https://example.com/8.2.1-0ace3c53c3b52a07b1bf4ca239d5162e/sdkjs/word/sdk-all.js:14985
<anonymous> https://example.com/8.2.1-0ace3c53c3b52a07b1bf4ca239d5162e/sdkjs/word/sdk-all.js:14993
<anonymous> https://example.com/8.2.1-0ace3c53c3b52a07b1bf4ca239d5162e/sdkjs/word/sdk-all.js:15149
sdk-all-min.js line 1229 > Function line 3 > eval:87:17
<anoniem> https://example.com/8.2.1-0ace3c53c3b52a07b1bf4ca239d5162e/sdkjs/word/sdk-all-min.js line 1229 > Function line 3 > eval:87
<anoniem> https://example.com/8.2.1-0ace3c53c3b52a07b1bf4ca239d5162e/sdkjs/word/sdk-all-min.js line 1229 > Function line 3 > eval:97
anonymous https://example.com/8.2.1-0ace3c53c3b52a07b1bf4ca239d5162e/sdkjs/word/sdk-all-min.js line 1229 > Function:3
EDc https://example.com/8.2.1-0ace3c53c3b52a07b1bf4ca239d5162e/sdkjs/word/sdk-all-min.js:1230
Mhf https://example.com/8.2.1-0ace3c53c3b52a07b1bf4ca239d5162e/sdkjs/word/sdk-all.js:14984
Qzh https://example.com/8.2.1-0ace3c53c3b52a07b1bf4ca239d5162e/sdkjs/word/sdk-all.js:14983
h https://example.com/8.2.1-0ace3c53c3b52a07b1bf4ca239d5162e/sdkjs/word/sdk-all.js:14956
(Async: EventListener.handleEvent)
<anoniem> https://example.com/8.2.1-0ace3c53c3b52a07b1bf4ca239d5162e/sdkjs/word/sdk-all.js:14985
<anoniem> https://example.com/8.2.1-0ace3c53c3b52a07b1bf4ca239d5162e/sdkjs/word/sdk-all.js:14993
<anoniem> https://example.com/8.2.1-0ace3c53c3b52a07b1bf4ca239d5162e/sdkjs/word/sdk-all.js:15149
Reproduction Steps
This is called from within a plugin.
Create a function and run it with callCommand. See code below. This issue is related to issue #2920.
letindexOfBookmark=function(callback,at_cursor=false){runCommand(function(){letparId=function(par){returnpar.Ga.Wa;};letparText=function(par){letraw_txt=par.GetText();lettxt=raw_txt.replace(/[\n\r\t]/g,'').replace(/[\\]u[0-9a-f][0-9a-f][0-9a-f][0-9][a-f]/g,'').replace(/[^\x20-\x7E]/g,'').replace(/\s/g,'');returntxt.trim();};letpartOf=function(bookmark,sel,range){//console.log(bookmark, range.GetText(), sel.GetText());letnrange=range.IntersectWith(sel);// If we have an intersection, the selection intersects with the bookmark and // we should know that this bookmark is selected and no new bookmark must be created.// preferably it should also be possible to see if the current caret position is in a bookmark. // however. IntersectWith is not reliable (version 8.1.3) so we need to do some extra work// to see if we are indeed an intersection. //console.log("nrange intersected");if(nrange!==null){//console.log('nrange !== null');letrange_txt=parText(range);letsel_txt=parText(sel);letsel_pars=sel.GetAllParagraphs();letrange_pars=range.GetAllParagraphs();letsel_par_cnt=sel_pars.map(function(par){return{txt: parText(par),id: [parId(par)]};});letrange_par_cnt=range_pars.map(function(par){return{txt: parText(par),id: [parId(par)]};});letsel_par_tot_txt='';letsel_par_ids=[];sel_par_cnt.forEach(function(obj){sel_par_tot_txt+=obj.txt;sel_par_ids.push(obj.id[0]);});sel_par_cnt.push({txt: sel_par_tot_txt,id: sel_par_ids});letrange_par_tot_txt='';letrange_par_ids=[];range_par_cnt.forEach(function(obj){range_par_tot_txt+=obj.txt;range_par_ids.push(obj.id[0]);});range_par_cnt.push({txt: range_par_tot_txt,id: range_par_ids});//console.log('sel_par_cnt=', sel_par_cnt);//console.log('range_par_cnt=', range_par_cnt);letsel_par_filtered=sel_par_cnt.filter(function(obj){returnsel_txt.indexOf(obj.txt)>=0||obj.txt.indexOf(sel_txt)>=0;});letrange_par_filtered=range_par_cnt.filter(function(obj){returnrange_txt.indexOf(obj.txt)>=0||obj.txt.indexOf(range_txt)>=0;});//console.log('sel_par_filtered=', sel_par_filtered);//console.log('range_par_filtered=', range_par_filtered);letsel_set=newSet();sel_par_filtered.forEach(function(obj){obj.id.forEach(function(id){sel_set.add(id);});});letrange_set=newSet();range_par_filtered.forEach(function(obj){obj.id.forEach(function(id){range_set.add(id);});});//console.log('sel_set=', sel_set);//console.log('range_set=', range_set);letintersection=sel_set.intersection(range_set);returnintersection.size>0;}else{// check if the paragraphs still intersect.//console.log('nrange === null');letsel_pars=sel.GetAllParagraphs();letrange_pars=range.GetAllParagraphs();letsel_par_cnt=sel_pars.map(function(par){returnparId(par);});letrange_par_cnt=range_pars.map(function(par){returnparId(par);});letsel_set=newSet(sel_par_cnt);letrange_set=newSet(range_par_cnt);letintersection=sel_set.intersection(range_set);returnintersection.size>0}};try{letargs=JSON.parse(Asc.scope.args);letdoc=Api.GetDocument();//let at_cursor = args.at_cursor;letdoc=Api.GetDocument();//if (at_cursor) {// There's no way to get the range of the cursor position (caret), so we try to select// the current word. // doc.SelectCurrentWord();//}letsel=doc.GetRangeBySelect();letbookmark_names=doc.GetAllBookmarksNames();letfound=0;letidx=-1;letbookmark_name='';leti;//console.log(bookmark_names.length);for(i=0;i<bookmark_names.length;i++){letbookmark=bookmark_names[i];letrange=doc.GetBookmarkRange(bookmark);try{if(partOf(bookmark,sel,range)){found+=1;idx=i;bookmark_name=bookmark;}}catch(e){console.error(e);}}console.log('found=',found,'idx=',idx,'bookmark=',bookmark_name);letobj={found_count: found,idx: idx,bookmark: bookmark_name};returnJSON.stringify(obj);}catch(e){console.error('indexOfBookmark error:',e);returnnull;}},function(result){if(result!==null){letobj=JSON.parse(result);callback(obj);}},{at_cursor: at_cursor});};
Additional information
So it breaks on the bullet list.
(Also the parId() function does not work anymore with 8.2.1, it will give an exception: par.Ga is undefined).
Also, the search function for if a bookmark is selected would be much simpler if the intersectwith function would work correctly:
This issue is unique.
Operating System of DocumentServer
Docker
Version information
8.2.1
Expected Behavior
A new range on intersection or 'null' when nothing intersects.
Actual Behavior
An exception:
Reproduction Steps
This is called from within a plugin.
Create a function and run it with callCommand. See code below. This issue is related to issue #2920.
Additional information
So it breaks on the bullet list.
(Also the parId() function does not work anymore with 8.2.1, it will give an exception: par.Ga is undefined).
Also, the search function for if a bookmark is selected would be much simpler if the intersectwith function would work correctly:
The text was updated successfully, but these errors were encountered: