File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,21 @@ export const encodeBase64 = (text: string): string => {
2424} ;
2525
2626export const getTextSiyuanFromTextHTML = ( html : string ) => {
27+ const trimmedHtml = html . trimStart ( ) ;
28+ if ( trimmedHtml . startsWith ( "<html" ) ) {
29+ const htmlTagEnd = trimmedHtml . indexOf ( ">" ) ;
30+ if ( htmlTagEnd > 0 ) {
31+ const htmlTag = trimmedHtml . substring ( 0 , htmlTagEnd ) ;
32+ // 兼容 Microsoft Excel 应用,HTML 以包含 Excel 命名空间声明的 html 元素开头(备注:从 WPS 复制也有这个命名空间)
33+ if ( htmlTag . includes ( 'xmlns:x="urn:schemas-microsoft-com:office:excel"' ) ) {
34+ // 粘贴表格不需要解析 textSiyuan https://ld246.com/article/1763027417781/comment/1763032527460#comments
35+ return {
36+ textSiyuan : "" ,
37+ textHtml : html
38+ } ;
39+ }
40+ }
41+ }
2742 const siyuanMatch = html . match ( / < ! - - d a t a - s i y u a n = ' ( [ ^ ' ] + ) ' - - > / ) ;
2843 let textSiyuan = "" ;
2944 let textHtml = html ;
You can’t perform that action at this time.
0 commit comments