Skip to content

Commit

Permalink
solves js code issue that prevented dark mode detection on navigation.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevodwyer committed Feb 20, 2024
1 parent 120f380 commit ba8cc0e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion assets/apps/markup-viewer/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ window.addEventListener('message', function (e) {
mainWindow = e.source;
origin = e.origin;

var jsonNoteData = {blocks: [], version: "", time: ""}
if (e.data.action == "ping") {
mainWindow.postMessage({action:'pong'}, e.origin);
} else if(e.data.action == "respondToLoadImage"){
Expand All @@ -19,7 +20,6 @@ window.addEventListener('message', function (e) {
let markdownThemeToUse = e.data.theme != null && e.data.theme == 'dark-mode' ? 'dark' : 'light';
if (e.data.extension == 'note') {
initialiseMarkdownEditor(markdownThemeToUse, e.data.subPath, '');
var jsonNoteData = {blocks: [], version: "", time: ""}
if (e.data.text.length > 0) {
try {
jsonNoteData = JSON.parse(e.data.text);
Expand Down
3 changes: 2 additions & 1 deletion src/components/viewers/Markup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,14 @@ module.exports = {
let extension = filename.substring(filename.lastIndexOf('.') + 1);
let that = this;
this.showSpinner = true;
let theme = this.$store.getters.currentTheme;
this.findFile(completePath, false).thenApply(file => {
if (file != null) {
that.readInFile(file).thenApply(data => {
that.setFullPathForDisplay();
let iframe = document.getElementById("md-editor");
let func = function() {
iframe.contentWindow.postMessage({action: "respondToNavigateTo", text:new TextDecoder().decode(data)
iframe.contentWindow.postMessage({action: "respondToNavigateTo", theme: theme, text:new TextDecoder().decode(data)
, extension: extension, subPath: subPath}, '*');
that.showSpinner = false;
};
Expand Down

0 comments on commit ba8cc0e

Please sign in to comment.