Skip to content

Commit

Permalink
fix: bug with numbering outside wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
VolodymyrBaydalka committed Sep 12, 2022
1 parent bf51a7c commit 75a7612
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
5 changes: 3 additions & 2 deletions dist/docx-preview.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/docx-preview.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/docx-preview.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/docx-preview.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "docx-preview",
"version": "0.1.12",
"version": "0.1.13",
"license": "Apache-2.0",
"keywords": [
"word",
Expand Down
6 changes: 4 additions & 2 deletions src/html-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type CellVerticalMergeType = Record<number, HTMLTableCellElement>;
export class HtmlRenderer {

className: string = "docx";
rootSelector: string;
document: WordDocument;
options: Options;
styleMap: Record<string, IDomStyle> = {};
Expand Down Expand Up @@ -63,6 +64,7 @@ export class HtmlRenderer {
this.document = document;
this.options = options;
this.className = options.className;
this.rootSelector = options.inWrapper ? `.${this.className}-wrapper` : ':root';
this.styleMap = null;

styleContainer = styleContainer || bodyContainer;
Expand Down Expand Up @@ -541,7 +543,7 @@ section.${c}>article { margin-bottom: auto; }
}, num.bullet.style);

this.document.loadNumberingImage(num.bullet.src).then(data => {
var text = `.${this.className}-wrapper { ${valiable}: url(${data}) }`;
var text = `${this.rootSelector} { ${valiable}: url(${data}) }`;
styleContainer.appendChild(createStyleElement(text));
});
}
Expand Down Expand Up @@ -576,7 +578,7 @@ section.${c}>article { margin-bottom: auto; }
}

if (rootCounters.length > 0) {
styleText += this.styleToString(`.${this.className}-wrapper`, {
styleText += this.styleToString(this.rootSelector, {
"counter-reset": rootCounters.join(" ")
});
}
Expand Down

0 comments on commit 75a7612

Please sign in to comment.