HAR-9653 - improve import and export of html annotation#502
Conversation
1432d24 to
12bfa31
Compare
| 'w:val': attrs.multipleImage, | ||
| }, | ||
| }, | ||
| { |
There was a problem hiding this comment.
Save fontFamily and fontSize as attributes to re-import annotations correctly.
| return { width, height }; | ||
| } | ||
|
|
||
| function applyMarksToHtmlAnnotation(state, marks) { |
There was a problem hiding this comment.
Apply font marks (*attributes as marks) of html annotation to inner content of annotation, but do not override if text node already has font styles. This is necessary for the final doc export, so the paragraph text look the same (as annotation).
| fontSize: fontSize !== 'null' ? fontSize : null, | ||
| }; | ||
|
|
||
| const allAttrs = { ...attrs, ...marksAsAttrs }; |
There was a problem hiding this comment.
For regular text fields, fontFamily and fontSize will be in attrs and marksAsAttrs. It will be overridden from the last object.
For html fields, fontFamily and fontSize will be only in attrs object.
| if (type === 'html') { | ||
| /// Note: html annotation has a different structure and can include | ||
| /// several paragraphs with different styles. We could find the first paragraph | ||
| /// and take the marks from there, but we take fontFamily and fontSize from the annotation attributes. |
There was a problem hiding this comment.
There is no processing for html field, since getting fontFamily and fontSize from attributes is a more correct solution in my opinion.
12bfa31 to
159b032
Compare
159b032 to
9eb08d9
Compare
Added comments in the code explaining the changes.