wiki-plugin-rcngraph 0.1.11 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/rcn-graph.js +21 -0
- package/client/rcngraph.js +21 -0
- package/package.json +1 -1
package/client/rcn-graph.js
CHANGED
|
@@ -77,6 +77,18 @@
|
|
|
77
77
|
if (popup) popup.focus()
|
|
78
78
|
})
|
|
79
79
|
$item.on('dblclick', () => wiki.textEditor($item, item))
|
|
80
|
+
// Labels in the saved SVG are wrapped as <a class="internal" data-title=…>, but
|
|
81
|
+
// two things stopped a click reaching the page: the <text> keeps the canvas's
|
|
82
|
+
// pointer-events="none", so the click fell through to the box behind it; and
|
|
83
|
+
// FedWiki's own .internal handler names the page from the clicked <tspan>, so a
|
|
84
|
+
// two-line label would land on its first line. Follow data-title here instead.
|
|
85
|
+
// Namespaced and reset, because a save re-runs bind on the same element.
|
|
86
|
+
$item.off('click.rcnlink').on('click.rcnlink', 'svg a.internal', e => {
|
|
87
|
+
e.preventDefault()
|
|
88
|
+
e.stopPropagation()
|
|
89
|
+
const title = e.currentTarget.getAttribute('data-title')
|
|
90
|
+
if (title) wiki.doInternalLink(title, e.shiftKey ? null : $item.parents('.page:first'))
|
|
91
|
+
})
|
|
80
92
|
}
|
|
81
93
|
|
|
82
94
|
function graphListener(event) {
|
|
@@ -118,6 +130,15 @@
|
|
|
118
130
|
}
|
|
119
131
|
}
|
|
120
132
|
|
|
133
|
+
// CSS outranks SVG presentation attributes, so this re-enables clicks on labels
|
|
134
|
+
// in items saved before the Graph Tool stopped writing pointer-events="none".
|
|
135
|
+
if (typeof document !== 'undefined' && !document.getElementById('rcngraph-link-style')) {
|
|
136
|
+
const s = document.createElement('style')
|
|
137
|
+
s.id = 'rcngraph-link-style'
|
|
138
|
+
s.textContent = '.rcngraph svg a.internal text,.rcn-graph svg a.internal text{pointer-events:auto;cursor:pointer}'
|
|
139
|
+
document.head.appendChild(s)
|
|
140
|
+
}
|
|
141
|
+
|
|
121
142
|
if (typeof window !== 'undefined') {
|
|
122
143
|
window.plugins['rcn-graph'] = { emit, bind }
|
|
123
144
|
if (!window.rcnGraphLegacyListener) {
|
package/client/rcngraph.js
CHANGED
|
@@ -79,6 +79,18 @@
|
|
|
79
79
|
if (popup) popup.focus()
|
|
80
80
|
})
|
|
81
81
|
$item.on('dblclick', () => wiki.textEditor($item, item))
|
|
82
|
+
// Labels in the saved SVG are wrapped as <a class="internal" data-title=…>, but
|
|
83
|
+
// two things stopped a click reaching the page: the <text> keeps the canvas's
|
|
84
|
+
// pointer-events="none", so the click fell through to the box behind it; and
|
|
85
|
+
// FedWiki's own .internal handler names the page from the clicked <tspan>, so a
|
|
86
|
+
// two-line label would land on its first line. Follow data-title here instead.
|
|
87
|
+
// Namespaced and reset, because a save re-runs bind on the same element.
|
|
88
|
+
$item.off('click.rcnlink').on('click.rcnlink', 'svg a.internal', e => {
|
|
89
|
+
e.preventDefault()
|
|
90
|
+
e.stopPropagation()
|
|
91
|
+
const title = e.currentTarget.getAttribute('data-title')
|
|
92
|
+
if (title) wiki.doInternalLink(title, e.shiftKey ? null : $item.parents('.page:first'))
|
|
93
|
+
})
|
|
82
94
|
}
|
|
83
95
|
|
|
84
96
|
function graphListener(event) {
|
|
@@ -122,6 +134,15 @@
|
|
|
122
134
|
}
|
|
123
135
|
}
|
|
124
136
|
|
|
137
|
+
// CSS outranks SVG presentation attributes, so this re-enables clicks on labels
|
|
138
|
+
// in items saved before the Graph Tool stopped writing pointer-events="none".
|
|
139
|
+
if (typeof document !== 'undefined' && !document.getElementById('rcngraph-link-style')) {
|
|
140
|
+
const s = document.createElement('style')
|
|
141
|
+
s.id = 'rcngraph-link-style'
|
|
142
|
+
s.textContent = '.rcngraph svg a.internal text,.rcn-graph svg a.internal text{pointer-events:auto;cursor:pointer}'
|
|
143
|
+
document.head.appendChild(s)
|
|
144
|
+
}
|
|
145
|
+
|
|
125
146
|
if (typeof window !== 'undefined') {
|
|
126
147
|
window.plugins['rcngraph'] = { emit, bind }
|
|
127
148
|
if (!window.rcnGraphListener) {
|