Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ol lists not restarting numbering on sub items #15

Closed
SunnysideAaron opened this issue Sep 23, 2019 · 4 comments
Closed

ol lists not restarting numbering on sub items #15

SunnysideAaron opened this issue Sep 23, 2019 · 4 comments

Comments

@SunnysideAaron
Copy link

SunnysideAaron commented Sep 23, 2019

when I switch my lists over to ordered lists the numbering doesn't reset for each sublist. Example from our UI:
Screen Shot 2019-09-23 at 3 18 23 PM
Example output from html-to-pdfmake
Screen Shot 2019-09-23 at 3 18 14 PM

I'm unable to output the code being passed to pdfmake because I get an error when I convert to ordered lists

stringify.js:4 Uncaught (in promise) TypeError: Converting circular structure to JSON
--> starting at object with constructor 'r'
| property '_root' -> object with constructor 'n'
--- property 'document' closes the circle
at Object.stringify ()
at stringify (stringify.js:4)
at VueComponent._callee$ (VisitNote.vue?5ab0890e:241)
at tryCatch (runtime.js:62)
at Generator.invoke [as _invoke] (runtime.js:296)
at Generator.prototype. [as next] (runtime.js:114)
at step (asyncToGenerator.js:17)
at asyncToGenerator.js:35
at new Promise ()
at new F (_export.js:36)

here is a part of the code of what is being passed to pdfmake when the list is unordered
{
"ul": [
{
"text": "hjk",
"style": ["html-li"],
"_margin": [5, 0, 0, 0],
"_inlines": [],
"_minWidth": 20.556640625,
"_maxWidth": 20.556640625,
"listMarker": {
"canvas": [
{
"x": 27,
"y": 137.0859375,
"r1": 2,
"r2": 2,
"type": "ellipse",
"color": "black"
}
],
"_maxWidth": 12.8671875,
"_minWidth": 12.8671875,
"_maxHeight": 14.0625,
"_minHeight": 14.0625
},
"positions": [
{
"pageNumber": 1,
"pageOrientation": "portrait",
"pageInnerHeight": 662,
"pageInnerWidth": 572,
"left": 37.8671875,
"top": 129.953125,
"verticalRatio": 0.0754578927492447,
"horizontalRatio": 0.031236341783216784
}
]
}, {
"text": "lk",
"style": ["ql-indent-1", "html-li"],
"_margin": [25, 0, 0, 0],
"_inlines": [],
"_minWidth": 33.994140625,
"_maxWidth": 33.994140625,
"listMarker": {
"canvas": [
{
"x": 47,
"y": 151.1484375,
"r1": 2,
"r2": 2,
"type": "ellipse",
"color": "black"
}
],
"_maxWidth": 12.8671875,
"_minWidth": 12.8671875,
"_maxHeight": 14.0625,
"_minHeight": 14.0625
},
"positions": [
{
"pageNumber": 1,
"pageOrientation": "portrait",
"pageInnerHeight": 662,
"pageInnerWidth": 572,
"left": 57.8671875,
"top": 144.015625,
"verticalRatio": 0.09670033987915408,
"horizontalRatio": 0.06620137674825174
}
]
}, {
"text": "sflkf",
"style": ["ql-indent-2", "html-li"],
"_margin": [45, 0, 0, 0],
"_inlines": [],
"_minWidth": 68.25,
"_maxWidth": 68.25,
"listMarker": {
"canvas": [
{
"x": 67,
"y": 165.2109375,
"r1": 2,
"r2": 2,
"type": "ellipse",
"color": "black"
}
],
"_maxWidth": 12.8671875,
"_minWidth": 12.8671875,
"_maxHeight": 14.0625,
"_minHeight": 14.0625
},
"positions": [
{
"pageNumber": 1,
"pageOrientation": "portrait",
"pageInnerHeight": 662,
"pageInnerWidth": 572,
"left": 77.8671875,
"top": 158.078125,
"verticalRatio": 0.11794278700906344,
"horizontalRatio": 0.10116641171328672
}
]
}, {
"text": "lkfjsdf",
"style": ["ql-indent-3", "html-li"],
"_margin": [65, 0, 0, 0],
"_inlines": [],
"_minWidth": 98.146484375,
"_maxWidth": 98.146484375,
"listMarker": {
"canvas": [
{
"x": 87,
"y": 179.2734375,
"r1": 2,
"r2": 2,
"type": "ellipse",
"color": "black"
}
],
"_maxWidth": 12.8671875,
"_minWidth": 12.8671875,
"_maxHeight": 14.0625,
"_minHeight": 14.0625
},
"positions": [
{
"pageNumber": 1,
"pageOrientation": "portrait",
"pageInnerHeight": 662,
"pageInnerWidth": 572,
"left": 97.8671875,
"top": 172.140625,
"verticalRatio": 0.1391852341389728,
"horizontalRatio": 0.13613144667832167
}
]
}, {
"text": "kldfsj",
"style": ["ql-indent-4", "html-li"],
"_margin": [85, 0, 0, 0],
"_inlines": [],
"_minWidth": 113.98046875,
"_maxWidth": 113.98046875,
"listMarker": {
"canvas": [
{
"x": 107,
"y": 193.3359375,
"r1": 2,
"r2": 2,
"type": "ellipse",
"color": "black"
}
],
"_maxWidth": 12.8671875,
"_minWidth": 12.8671875,
"_maxHeight": 14.0625,
"_minHeight": 14.0625
},
"positions": [
{
"pageNumber": 1,
"pageOrientation": "portrait",
"pageInnerHeight": 662,
"pageInnerWidth": 572,
"left": 117.8671875,
"top": 186.203125,
"verticalRatio": 0.16042768126888218,
"horizontalRatio": 0.17109648164335664
}
]
}, {
"text": "dkslfjl",
"style": ["ql-indent-5", "html-li"],
"_margin": [105, 0, 0, 0],
"_inlines": [],
"_minWidth": 136.892578125,
"_maxWidth": 136.892578125,
"listMarker": {
"canvas": [
{
"x": 127,
"y": 207.3984375,
"r1": 2,
"r2": 2,
"type": "ellipse",
"color": "black"
}
],
"_maxWidth": 12.8671875,
"_minWidth": 12.8671875,
"_maxHeight": 14.0625,
"_minHeight": 14.0625
},
"positions": [
{
"pageNumber": 1,
"pageOrientation": "portrait",
"pageInnerHeight": 662,
"pageInnerWidth": 572,
"left": 137.8671875,
"top": 200.265625,
"verticalRatio": 0.18167012839879154,
"horizontalRatio": 0.20606151660839161
}
]
}, {
"text": "ksdflj",
"style": ["ql-indent-6", "html-li"],
"_margin": [125, 0, 0, 0],
"_inlines": [],
"_minWidth": 153.716796875,
"_maxWidth": 153.716796875,
"listMarker": {
"canvas": [
{
"x": 147,
"y": 221.4609375,
"r1": 2,
"r2": 2,
"type": "ellipse",
"color": "black"
}
],
"_maxWidth": 12.8671875,
"_minWidth": 12.8671875,
"_maxHeight": 14.0625,
"_minHeight": 14.0625
},
"positions": [
{
"pageNumber": 1,
"pageOrientation": "portrait",
"pageInnerHeight": 662,
"pageInnerWidth": 572,
"left": 157.8671875,
"top": 214.328125,
"verticalRatio": 0.2029125755287009,
"horizontalRatio": 0.24102655157342656
}
]
}, {
"text": "fskldj",
"style": ["ql-indent-7", "html-li"],
"_margin": [145, 0, 0, 0],
"_inlines": [],
"_minWidth": 173.98046875,
"_maxWidth": 173.98046875,
"listMarker": {
"canvas": [
{
"x": 167,
"y": 235.5234375,
"r1": 2,
"r2": 2,
"type": "ellipse",
"color": "black"
}
],
"_maxWidth": 12.8671875,
"_minWidth": 12.8671875,
"_maxHeight": 14.0625,
"_minHeight": 14.0625
},
"positions": [
{
"pageNumber": 1,
"pageOrientation": "portrait",
"pageInnerHeight": 662,
"pageInnerWidth": 572,
"left": 177.8671875,
"top": 228.390625,
"verticalRatio": 0.22415502265861026,
"horizontalRatio": 0.27599158653846156
}
]
}, {
"text": "fdslka",
"style": ["ql-indent-8", "html-li"],
"_margin": [165, 0, 0, 0],
"_inlines": [],
"_minWidth": 197.501953125,
"_maxWidth": 197.501953125,
"listMarker": {
"canvas": [
{
"x": 187,
"y": 249.5859375,
"r1": 2,
"r2": 2,
"type": "ellipse",
"color": "black"
}
],
"_maxWidth": 12.8671875,
"_minWidth": 12.8671875,
"_maxHeight": 14.0625,
"_minHeight": 14.0625
},
"positions": [
{
"pageNumber": 1,
"pageOrientation": "portrait",
"pageInnerHeight": 662,
"pageInnerWidth": 572,
"left": 197.8671875,
"top": 242.453125,
"verticalRatio": 0.24539746978851965,
"horizontalRatio": 0.3109566215034965
}
]
}, {
"text": "nine",
"style": ["ql-indent-8", "html-li"],
"_margin": [165, 0, 0, 0],
"_inlines": [],
"_minWidth": 187.51171875,
"_maxWidth": 187.51171875,
"listMarker": {
"canvas": [
{
"x": 187,
"y": 263.6484375,
"r1": 2,
"r2": 2,
"type": "ellipse",
"color": "black"
}
],
"_maxWidth": 12.8671875,
"_minWidth": 12.8671875,
"_maxHeight": 14.0625,
"_minHeight": 14.0625
},
"positions": [
{
"pageNumber": 1,
"pageOrientation": "portrait",
"pageInnerHeight": 662,
"pageInnerWidth": 572,
"left": 197.8671875,
"top": 256.515625,
"verticalRatio": 0.266639916918429,
"horizontalRatio": 0.3109566215034965
}
]
}, {
"text": "klj",
"style": ["html-li"],
"_margin": [5, 0, 0, 0],
"_inlines": [],
"_minWidth": 16.859375,
"_maxWidth": 16.859375,
"listMarker": {
"canvas": [
{
"x": 27,
"y": 277.7109375,
"r1": 2,
"r2": 2,
"type": "ellipse",
"color": "black"
}
],
"_maxWidth": 12.8671875,
"_minWidth": 12.8671875,
"_maxHeight": 14.0625,
"_minHeight": 14.0625
},
"positions": [
{
"pageNumber": 1,
"pageOrientation": "portrait",
"pageInnerHeight": 662,
"pageInnerWidth": 572,
"left": 37.8671875,
"top": 270.578125,
"verticalRatio": 0.2878823640483384,
"horizontalRatio": 0.031236341783216784
}
]
}
],
"style": ["html-ul"],
"marginBottom": 5,
"_margin": [0, 0, 0, 5],
"type": "disc",
"_gapSize": {
"width": 12.8671875,
"height": 14.0625,
"fontSize": 12,
"lineHeight": 1,
"ascender": 11.1328125,
"descender": -2.9296875
},
"_minWidth": 210.369140625,
"_maxWidth": 210.369140625,
"positions": [
{
"pageNumber": 1,
"pageOrientation": "portrait",
"pageInnerHeight": 662,
"pageInnerWidth": 572,
"left": 37.8671875,
"top": 129.953125,
"verticalRatio": 0.0754578927492447,
"horizontalRatio": 0.031236341783216784
}, {
"pageNumber": 1,
"pageOrientation": "portrait",
"pageInnerHeight": 662,
"pageInnerWidth": 572,
"left": 57.8671875,
"top": 144.015625,
"verticalRatio": 0.09670033987915408,
"horizontalRatio": 0.06620137674825174
}, {
"pageNumber": 1,
"pageOrientation": "portrait",
"pageInnerHeight": 662,
"pageInnerWidth": 572,
"left": 77.8671875,
"top": 158.078125,
"verticalRatio": 0.11794278700906344,
"horizontalRatio": 0.10116641171328672
}, {
"pageNumber": 1,
"pageOrientation": "portrait",
"pageInnerHeight": 662,
"pageInnerWidth": 572,
"left": 97.8671875,
"top": 172.140625,
"verticalRatio": 0.1391852341389728,
"horizontalRatio": 0.13613144667832167
}, {
"pageNumber": 1,
"pageOrientation": "portrait",
"pageInnerHeight": 662,
"pageInnerWidth": 572,
"left": 117.8671875,
"top": 186.203125,
"verticalRatio": 0.16042768126888218,
"horizontalRatio": 0.17109648164335664
}, {
"pageNumber": 1,
"pageOrientation": "portrait",
"pageInnerHeight": 662,
"pageInnerWidth": 572,
"left": 137.8671875,
"top": 200.265625,
"verticalRatio": 0.18167012839879154,
"horizontalRatio": 0.20606151660839161
}, {
"pageNumber": 1,
"pageOrientation": "portrait",
"pageInnerHeight": 662,
"pageInnerWidth": 572,
"left": 157.8671875,
"top": 214.328125,
"verticalRatio": 0.2029125755287009,
"horizontalRatio": 0.24102655157342656
}, {
"pageNumber": 1,
"pageOrientation": "portrait",
"pageInnerHeight": 662,
"pageInnerWidth": 572,
"left": 177.8671875,
"top": 228.390625,
"verticalRatio": 0.22415502265861026,
"horizontalRatio": 0.27599158653846156
}, {
"pageNumber": 1,
"pageOrientation": "portrait",
"pageInnerHeight": 662,
"pageInnerWidth": 572,
"left": 197.8671875,
"top": 242.453125,
"verticalRatio": 0.24539746978851965,
"horizontalRatio": 0.3109566215034965
}, {
"pageNumber": 1,
"pageOrientation": "portrait",
"pageInnerHeight": 662,
"pageInnerWidth": 572,
"left": 197.8671875,
"top": 256.515625,
"verticalRatio": 0.266639916918429,
"horizontalRatio": 0.3109566215034965
}, {
"pageNumber": 1,
"pageOrientation": "portrait",
"pageInnerHeight": 662,
"pageInnerWidth": 572,
"left": 37.8671875,
"top": 270.578125,
"verticalRatio": 0.2878823640483384,
"horizontalRatio": 0.031236341783216784
}
]
}

probably a lot of unrelated cruft. One of the big things that I noticed was that html-to-pdfmake seems to rely on styles to indent some items. but when I check lists on the pdfmake sandbox http://pdfmake.org/playground.html the sublists items have their own ul or ol tags.

@SunnysideAaron
Copy link
Author

here's the html being passed in

<p>I"m a block of text</p><ul><li>hjk</li><li class="ql-indent-1">lk</li><li class="ql-indent-2">sflkf</li><li class="ql-indent-3">lkfjsdf</li><li class="ql-indent-4">kldfsj</li><li class="ql-indent-5">dkslfjl</li><li class="ql-indent-6">ksdflj</li><li class="ql-indent-7">fskldj</li><li class="ql-indent-8">fdslka</li><li class="ql-indent-8">nine</li><li>klj</li></ul>

@SunnysideAaron
Copy link
Author

turns out this is a well known vue2editor -> quill issue
slab/quill#1314
slab/quill#979

https://gist.github.com/Vovan-VE/46934917f4c39a07705c5012a9b9fba9

@SunnysideAaron
Copy link
Author

though you might want to take a quick moment to figure out why the error is popping up when an ol list is passed.

@Aymkdn
Copy link
Owner

Aymkdn commented Sep 24, 2019

though you might want to take a quick moment to figure out why the error is popping up when an ol list is passed.

I've just tried the below in the live demo:

<ol>
    <li>one</li>
    <li>two
      <ol>
          <li>two-one</li>
          <li>two-two</li>
      </ol>
    </li>
    <li>three</li>
</ol>

And it renders OK and I don't receive any error:
Capture

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants