Skip to content

Commit d1f7ed1

Browse files
committed
provide better fallback if uiRootPath config setting cannot be found or is empty
1 parent e829f1f commit d1f7ed1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/js/06-copy-to-clipboard.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
var TRAILING_SPACE_RX = / +$/gm
77

88
var config = (document.getElementById('site-script') || { dataset: {} }).dataset
9-
var uiRootPath = config.uiRootPath == null ? '.' : config.uiRootPath
10-
var svgAs = config.svgAs
119
var supportsCopy = window.navigator.clipboard
10+
var svgAs = config.svgAs
11+
var uiRootPath = (config.uiRootPath == null ? window.uiRootPath : config.uiRootPath) || '.'
1212

1313
;[].slice.call(document.querySelectorAll('.doc pre.highlight, .doc .literalblock pre')).forEach(function (pre) {
1414
var code, language, lang, copy, toast, toolbox

0 commit comments

Comments
 (0)