Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Statistics
lessons
Commits
0df6fc55
Commit
0df6fc55
authored
Apr 23, 2019
by
ROBERT PATRICK CAREY III
🗿
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New Link - Paragraph Inspector
parent
f94ef1c7
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
4 deletions
+42
-4
modules/user_preferences/js/dist/user-preferences.js
modules/user_preferences/js/dist/user-preferences.js
+1
-1
modules/user_preferences/js/src/user-preferences.js
modules/user_preferences/js/src/user-preferences.js
+28
-0
modules/user_preferences/user_preferences.module
modules/user_preferences/user_preferences.module
+13
-3
No files found.
modules/user_preferences/js/dist/user-preferences.js
View file @
0df6fc55
This diff is collapsed.
Click to expand it.
modules/user_preferences/js/src/user-preferences.js
View file @
0df6fc55
...
...
@@ -300,6 +300,10 @@ document.addEventListener("DOMContentLoaded", function(event) {
toggleFullscreen
();
});
$
(
"
.toggle-inspector
"
).
on
(
"
click touchstart
"
,
function
()
{
toggleParagraphInspector
();
});
$
(
"
.fontSlider
"
).
on
(
"
input change
"
,
function
()
{
preferences
.
setFontSize
(
this
.
value
);
});
...
...
@@ -317,6 +321,30 @@ document.addEventListener("DOMContentLoaded", function(event) {
else
enterFullscreen
();
}
function
toggleParagraphInspector
()
{
window
.
paragraphInspector
=
!
window
.
paragraphInspector
;
elements
=
document
.
querySelectorAll
(
'
.paragraph
'
);
if
(
window
.
paragraphInspector
){
elements
.
forEach
(
element
=>
{
tippy
(
'
#
'
+
element
.
id
,
{
content
:
'
Paragraph:
'
+
element
.
id
.
replace
(
'
paragraph--
'
,
''
),
arrow
:
true
,
interactive
:
true
,
onShow
(
tip
){
paragraph
.
style
.
outline
=
'
2px dashed var(--warning)
'
;
},
onHide
(
tip
){
paragraph
.
style
.
outline
=
''
;
}
})
});
}
else
{
elements
.
forEach
(
element
=>
{
element
.
_tippy
.
destroy
();
});
}
}
function
enterFullscreen
()
{
var
d
=
document
.
documentElement
;
if
(
d
.
requestFullscreen
)
d
.
requestFullscreen
();
...
...
modules/user_preferences/user_preferences.module
View file @
0df6fc55
...
...
@@ -10,8 +10,6 @@ use Drupal\node\NodeInterface;
use
Drupal\node\NodeTypeInterface
;
use
Drupal\node\Entity\Node
;
function
user_preferences_page_attachments_alter
(
&
$build
){
if
(
!
\
Drupal
::
service
(
'router.admin_context'
)
->
isAdminRoute
()){
$build
[
'#attached'
][
'library'
][]
=
'user_preferences/user-preferences'
;
...
...
@@ -78,7 +76,19 @@ function user_preferences_node_links_alter(array &$links, NodeInterface $node, a
'onclick'
=>
'jQuery("#accessibilityPanel").modal("toggle")'
,
'data-toggle'
=>
'tooltip'
,
'aria-label'
=>
'Accessibility tools'
,
]
]
];
$link
[
'paragraphInspector'
]
=
[
'title'
=>
t
(
'<i class="fal bullseye-pointer"> </i>'
),
'url'
=>
Url
::
fromUri
(
'internal:#toggleInspector'
),
'attributes'
=>
[
'title'
=>
t
(
'Identify Target'
),
'data-tippy-content'
=>
t
(
'Identify Target'
),
'id'
=>
'toggle_inspector'
,
'class'
=>
'toggle-inspector'
,
'data-toggle'
=>
'tooltip'
,
'aria-label'
=>
'Identify Target'
,
]
];
}
$link
[
'keyboardShortcuts'
]
=
[
...
...
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