Skip to content

Commit

Permalink
yaml: ajout de disableWarningMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
eyssette committed Nov 11, 2024
1 parent d9a107a commit 11dda60
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/lib/Menu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
defaultTemplate,
} from './stores.js'
export let source;
export let disableWarningMessage;
import url from './url.js';
import { fade, fly } from 'svelte/transition';
Expand Down Expand Up @@ -87,8 +88,10 @@
}
function beforeunload(event) {
event.preventDefault();
if(!disableWarningMessage) {
event.preventDefault();
return event.returnValue = '';
}
}
let showNotification = false;
Expand Down
2 changes: 2 additions & 0 deletions src/lib/stores.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ maxWidth: 600
- \`\`\`initialExpandLevel: 1\`\`\`
- Pour forcer l'ouverture des \\\\liens dans un nouvel onglet
- \`\`\`openLinksInNewTab: true\`\`\`
- Pour permettre l'ouverture automatique\\\\des liens et empêcher l'affichage du message\\\\ de confirmation pour quitter la page
- \`\`\`disableWarningMessage: true\`\`\`
- Pour contrôler l'interactivité
- \`\`\`automaticResize: false\`\`\` \\\\pour supprimer le \\\\redimensionnement automatique
- \`\`\`focusOnBranch: true\`\`\` \\\\pour focaliser sur la branche \\\\sur laquelle on clique et fermer\\\\automatiquement les autres
Expand Down
4 changes: 3 additions & 1 deletion src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
let colorFreezeLevel = 0;
let initialExpandLevel = -1;
let openLinksInNewTab = false;
let disableWarningMessage = false;
let theme = '';
let curves = true;
const corsProxy = "https://corsproxy.io/?"
Expand Down Expand Up @@ -132,6 +133,7 @@
showMenu = yamlData.hasOwnProperty('showMenu')? yamlData.showMenu : true;
curves = yamlData.hasOwnProperty('curves') ? yamlData.curves : true;
theme = yamlData.hasOwnProperty('theme') ? yamlData.theme : '';
disableWarningMessage = yamlData.hasOwnProperty('disableWarningMessage') ? yamlData.disableWarningMessage : false;
if(theme == 'focus' || theme == 'nolines' || theme == 'black') {
if(theme == 'focus' || theme == 'nolines') {
maxWidthFromYAML = yamlData.hasOwnProperty('maxWidth') ? yamlData.maxWidth : 250;
Expand Down Expand Up @@ -165,7 +167,7 @@
</script>


<Menu source={$markdownSource} {showMenu}/>
<Menu source={$markdownSource} {showMenu} {disableWarningMessage}/>

<main>

Expand Down

0 comments on commit 11dda60

Please sign in to comment.