Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pagedjs
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
julien
pagedjs
Commits
fea1253a
Commit
fea1253a
authored
Apr 09, 2018
by
Fred Chasen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates for CLI
parent
6fcb632a
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
192 additions
and
5 deletions
+192
-5
LICENSE
LICENSE
+1
-1
editor.html
examples/editor.html
+160
-0
polyfill.js
src/polyfill/polyfill.js
+13
-2
sheet.js
src/styles/sheet.js
+6
-2
styler.js
src/styles/styler.js
+12
-0
No files found.
LICENSE
View file @
fea1253a
The MIT License (MIT)
Copyright (c) 201
5 Pagedmedia.org
Copyright (c) 201
8 Adam Hyde
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
...
...
examples/editor.html
0 → 100644
View file @
fea1253a
This diff is collapsed.
Click to expand it.
src/polyfill/polyfill.js
View file @
fea1253a
...
...
@@ -4,9 +4,14 @@ import Styler from '../styles/styler';
// let ready = new Promise(function($){document.addEventListener('DOMContentLoaded',$,{once:true})});
let
ready
=
new
Promise
(
function
(
resolve
,
reject
){
if
(
document
.
readyState
===
"
interactive
"
||
document
.
readyState
===
"
complete
"
)
{
resolve
(
document
.
readyState
);
return
;
}
document
.
onreadystatechange
=
function
(
$
)
{
if
(
document
.
readyState
===
"
interactive
"
)
{
resolve
(
$
);
resolve
(
document
.
readyState
);
}
}
});
...
...
@@ -59,6 +64,12 @@ ready.then(async function () {
let
flow
=
await
chunker
.
flow
(
template
.
content
,
styles
);
let
endTime
=
performance
.
now
();
console
.
log
(
"
Rendering
"
+
flow
.
total
+
"
pages took
"
+
(
endTime
-
startTime
)
+
"
milliseconds.
"
);
let
msg
=
"
Rendering
"
+
flow
.
total
+
"
pages took
"
+
(
endTime
-
startTime
)
+
"
milliseconds.
"
;
console
.
log
(
msg
);
if
(
typeof
window
.
onPagesRendered
!==
"
undefined
"
)
{
window
.
onPagesRendered
(
msg
,
styles
.
width
.
value
+
styles
.
width
.
unit
,
styles
.
height
.
value
+
styles
.
height
.
unit
,
styles
.
orientation
);
}
});
src/styles/sheet.js
View file @
fea1253a
...
...
@@ -29,8 +29,12 @@ class Sheet {
this
.
pages
=
this
.
replacePages
(
this
.
ast
);
if
(
"
*
"
in
this
.
pages
)
{
this
.
addRootVars
(
this
.
ast
,
this
.
pages
[
"
*
"
].
width
,
this
.
pages
[
"
*
"
].
height
);
this
.
addRootPage
(
this
.
ast
,
this
.
pages
[
"
*
"
].
width
,
this
.
pages
[
"
*
"
].
height
);
this
.
width
=
this
.
pages
[
"
*
"
].
width
;
this
.
height
=
this
.
pages
[
"
*
"
].
height
;
this
.
orientation
=
this
.
pages
[
"
*
"
].
orientation
;
this
.
addRootVars
(
this
.
ast
,
this
.
width
,
this
.
height
);
this
.
addRootPage
(
this
.
ast
,
this
.
width
,
this
.
height
);
}
this
.
stringSets
=
this
.
getStringSets
(
this
.
ast
);
...
...
src/styles/styler.js
View file @
fea1253a
...
...
@@ -52,6 +52,18 @@ class Styler {
this
.
sheets
.
push
(
sheet
);
if
(
typeof
sheet
.
width
!==
"
undefined
"
)
{
this
.
width
=
sheet
.
width
;
}
if
(
typeof
sheet
.
height
!==
"
undefined
"
)
{
this
.
height
=
sheet
.
height
;
}
if
(
typeof
sheet
.
orientation
!==
"
undefined
"
)
{
this
.
orientation
=
sheet
.
orientation
;
}
this
.
mergeBreaks
(
pageBreaks
,
sheet
.
pageBreaks
);
stringSets
=
Object
.
assign
(
stringSets
,
sheet
.
stringSets
);
textTargets
=
Object
.
assign
(
textTargets
,
sheet
.
textTargets
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment