Skip to content

Commit

Permalink
Fixes #109
Browse files Browse the repository at this point in the history
  • Loading branch information
IceEnd committed May 13, 2019
1 parent eb77906 commit a6e6715
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 17 deletions.
7 changes: 5 additions & 2 deletions app/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,17 @@ function createWindow() {
minWidth: 1200,
minHeight: 600,
titleBarStyle: 'default',
webPreferences: {
nodeIntegration: true,
webviewTag: true,
},
};
if (process.platform === 'linux') {
options.icon = path.join(__dirname, './resource/app.png');
}
if (process.platform === 'darwin') {
options.transparent = true;
options.frame = true;
// options.titleBarStyle = 'hiddenInset';
options.frame = false;
options.titleBarStyle = 'hidden';
}
mainWindow = new BrowserWindow(options);
Expand Down
2 changes: 1 addition & 1 deletion app/main/pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default class PDF {
});
content = markedToHtml(content);
return this.htmlTemplate
.replace(/(<div\s+id="?root"?\s+class="?[\w-_]+"?\s*>)\s*(<\/div>)/, `$1${content}$2`);
.replace(/(<div\s+id="?root".*>)\s*(<\/div>)/, `$1${content}$2`);
}

getHtmlTemplate() {
Expand Down
2 changes: 1 addition & 1 deletion app/main/webview/webview.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

</head>
<body>
<div id="root" class="wv-light"></div>
<div id="root" class="platform-pdf wv-light"></div>
<script nonce="WW9zb3Jv">
/**
* perfect-scrollbar v1.4.0
Expand Down
2 changes: 1 addition & 1 deletion app/views/assets/scss/note.scss
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@

.wv-dev-tools {
position: absolute;
top: 20%;
top: 50%;
right: .5rem;
font-size: 0.7rem;
padding: 0.3rem;
Expand Down
3 changes: 0 additions & 3 deletions app/views/container/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,6 @@ export default class App extends Component {

ipcRenderer.send('start-release-schedule');
ipcRenderer.send('get-images-list');
// if (!this.ps) {
// this.ps = new PerfectScrollbar('.custom-scrollbar');
// }
}

componentDidUpdate(prevProps) {
Expand Down
8 changes: 8 additions & 0 deletions app/webview/assets/css/marked.scss
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,14 @@ pre code {
font-weight: bold;
}

.platform-pdf {
pre {
white-space: pre-wrap;
word-wrap: break-word;
overflow: hidden !important;
}
}

.wv-dark {
color: #cacaca;

Expand Down
5 changes: 1 addition & 4 deletions app/webview/webview-pre.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const ipcRenderer = require('electron').ipcRenderer;
// const PerfectScrollbar = require('perfect-scrollbar');

let nodeRoot = null;

Expand Down Expand Up @@ -44,9 +43,6 @@ function setPlatform(platform) {
function setTheme(theme) {
const value = theme ? `wv-${theme}` : 'wv-light';
document.documentElement.className = document.documentElement.className.replace(/\bwv-\w*\b/, value);
// if (nodeRoot) {
// nodeRoot.className = nodeRoot.className.replace(/\bwv-\w*\b/, value);
// }
}

function handleInnerClick(event) {
Expand Down Expand Up @@ -87,6 +83,7 @@ document.addEventListener('DOMContentLoaded', () => {
editorMode = editorMode || 'normal';
if (!nodeRoot) {
nodeRoot = document.getElementById('root');
nodeRoot.classList.remove('platform-pdf');
}
checkMode(editorMode);
setPlatform(platform);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"css-loader": "^2.1.0",
"del": "^3.0.0",
"devtron": "^1.4.0",
"electron": "^4.0.7",
"electron": "^5.0.1",
"electron-installer-debian": "^1.1.1",
"electron-installer-dmg": "^2.0.0",
"electron-packager": "^13.1.1",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3977,10 +3977,10 @@ electron-winstaller@^2.7.0:
lodash.template "^4.2.2"
temp "^0.8.3"

electron@^4.0.7:
version "4.1.2"
resolved "https://registry.yarnpkg.com/electron/-/electron-4.1.2.tgz#dc8be0f219c73d60a97675d6d3c5b040c4f50513"
integrity sha512-QWz298CaH2jLyFVje01sj4fSEdXJj+oKVw2jNUovrhZE5jmFE4cr/KqZ7iHX00DG6AwmDF4W1Xrv0V+aQOkieQ==
electron@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/electron/-/electron-5.0.1.tgz#6bd7bf4d25e9bfce4cccd629d587fba5281f95cc"
integrity sha512-8KksyhAPcpXVeO8ViVGxfZAuf8yEVBCtV0h/lMBD8VFbCQ9icej1K5csCFAGirbZbqOz5IdsBZX9Gpb9n4RCag==
dependencies:
"@types/node" "^10.12.18"
electron-download "^4.1.0"
Expand Down

0 comments on commit a6e6715

Please sign in to comment.