Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
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
Cy Z
pagedjs
Commits
e98260cc
Commit
e98260cc
authored
Aug 16, 2020
by
Julie Blanc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correct <first-except>
parent
b8f8c57a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
17 deletions
+21
-17
string-sets.js
src/modules/generated-content/string-sets.js
+21
-17
No files found.
src/modules/generated-content/string-sets.js
View file @
e98260cc
...
...
@@ -73,21 +73,37 @@ class StringSets extends Handler {
console
.
log
(
selected
.
length
);
// Get the last found string for the current identifier
// Get the last found string for the current identifier
let
stringPrevPage
=
(
name
in
this
.
pageLastString
)
?
this
.
pageLastString
[
name
]
:
""
;
let
varFirst
,
varLast
,
varStart
,
varFirstExcept
let
varFirst
,
varLast
,
varStart
,
varFirstExcept
;
if
(
selected
.
length
==
0
){
// if there is no sel. on the page
varFirst
=
stringPrevPage
;
varLast
=
stringPrevPage
;
varStart
=
stringPrevPage
;
varFirstExcept
=
stringPrevPage
;
}
else
{
selected
.
forEach
((
sel
)
=>
{
// push each content into the array to define in the variable the first and the last element of the page.
this
.
pageLastString
[
name
]
=
selected
[
selected
.
length
-
1
].
textContent
;
});
/* FIRST */
varFirst
=
selected
[
0
].
textContent
;
/* LAST */
varLast
=
selected
[
selected
.
length
-
1
].
textContent
;
/* START */
// Hack to find if the sel. is the first elem of the page / find a better way
let
selTop
=
selected
[
0
].
getBoundingClientRect
().
top
;
let
pageContent
=
selected
[
0
].
closest
(
"
.pagedjs_page_content
"
);
...
...
@@ -99,29 +115,17 @@ class StringSets extends Handler {
varStart
=
stringPrevPage
;
}
selected
.
forEach
((
sel
)
=>
{
// push each content into the array to define in the variable the first and the last element of the page.
this
.
pageLastString
[
name
]
=
selected
[
selected
.
length
-
1
].
textContent
;
});
/* FIRST EXCEPT */
varFirstExcept
=
""
;
}
varFirstExcept
=
""
;
// fragment.setAttribute("data-string", `string-type-${this.type}-${name}`);
// fragment.style.setProperty(`--pagedjs-string-${name}`, `"${cleanPseudoContent(cssVar)}`);
fragment
.
style
.
setProperty
(
`--pagedjs-string-first-
${
name
}
`
,
`"
${
cleanPseudoContent
(
varFirst
)}
`
);
fragment
.
style
.
setProperty
(
`--pagedjs-string-last-
${
name
}
`
,
`"
${
cleanPseudoContent
(
varLast
)}
`
);
fragment
.
style
.
setProperty
(
`--pagedjs-string-start-
${
name
}
`
,
`"
${
cleanPseudoContent
(
varStart
)}
`
);
fragment
.
style
.
setProperty
(
`--pagedjs-string-first-except-
${
name
}
`
,
`"
${
cleanPseudoContent
(
varFirstExcept
)}
`
);
// if there is no new string on the page
// if (!fragment.hasAttribute("data-string")) {
// fragment.style.setProperty(`--pagedjs-string-${name}`, `"${this.pageLastString}"`);
// }
}
}
...
...
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