mirror of
https://github.com/tabler/tabler.git
synced 2026-08-08 20:32:24 +04:00
Fix replacing href="#" with href="javascript:void(0)" (#1720)
Replaces before using example variable. Replace all hrefs, not only in <a> tags. Co-authored-by: Bartłomiej Gawęda <bgaweda@abis.krakow.pl>
This commit is contained in:
@@ -42,6 +42,10 @@ const previewHtml = (
|
||||
}
|
||||
|
||||
let content = example;
|
||||
example = example
|
||||
.replace(/ href="[^"]+"/g, ' href="javascript:void(0)"')
|
||||
.replace(/action="[^"]+"/g, 'action="javascript:void(0)"');
|
||||
|
||||
if (!fullpage) {
|
||||
content = `<main class="min-vh-100 ${vertical ? 'p-4' : 'py-4 px-4'}${centered ? ' d-flex justify-content-center align-items-center flex-wrap' : ''}${vcentered ? ' d-flex justify-content-center flex-column' : ''}">
|
||||
|
||||
@@ -55,8 +59,6 @@ const previewHtml = (
|
||||
</main>`;
|
||||
}
|
||||
|
||||
example = example.replace(/a href="[^"]+"/g, 'a href="javascript:void(0)"').replace(/action="[^"]+"/g, 'action="javascript:void(0)"');
|
||||
|
||||
return `<html lang="en">
|
||||
<head>
|
||||
<title>Example</title>
|
||||
|
||||
Reference in New Issue
Block a user