Skip to content

Commit 8d653a2

Browse files
committed
Merge branch 'v.0.47.2'
2 parents 2363943 + fe837da commit 8d653a2

File tree

165 files changed

+5776
-128
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+5776
-128
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
[Publii](https://getpublii.com/) is a desktop-based CMS for Windows, Mac and Linux that makes creating static websites fast
1010
and hassle-free, even for beginners.
1111

12-
**Current version: 0.47.1 (build 17302)**
12+
**Current version: 0.47.2 (build 17336)**
1313

1414
## Why Publii?
1515
Unlike static-site generators that are often unwieldy and difficult to use, Publii provides an

app/back-end/app-preload.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ contextBridge.exposeInMainWorld('mainProcessAPI', {
102102
'app-close',
103103
'app-set-ui-zoom-level',
104104
'app-set-notifications-center-state',
105-
'app-get-notifications-file'
105+
'app-get-notifications-file',
106+
'app-pages-hierarchy-update'
106107
];
107108

108109
if (validChannels.includes(channel)) {

app/back-end/app.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,11 @@ class App {
609609
this.mainWindow.removeMenu();
610610

611611
// Register search shortcut listener
612-
this.mainWindow.webContents.on('before-input-event', (e, input) => {
612+
this.mainWindow.webContents.on('before-input-event', (event, input) => {
613+
if (input.type === 'mouseDown' && (input.button === 'back' || input.button === 'forward')) {
614+
event.preventDefault();
615+
}
616+
613617
if (input.key === 'f' && (input.meta || input.control)) {
614618
this.mainWindow.webContents.send('app-show-search-form');
615619
} else if (input.key === 'z' && (input.meta || input.control) && !input.shift) {

app/back-end/builddata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"version": "0.47.1",
3-
"build": 17302
2+
"version": "0.47.2",
3+
"build": 17336
44
}

app/back-end/events/page.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,13 @@ class PageEvents {
103103
});
104104

105105
// Update pages hierarchy during post conversion
106-
ipcMain.on('app-pages-hierarchy-update', (event, postIDs) => {
107-
let pagesFile = path.join(this.app.sitesDir, pagesData.siteName, 'input', 'config', 'pages.config.json');
106+
ipcMain.on('app-pages-hierarchy-update', (event, conversionData) => {
107+
let pagesFile = path.join(this.app.sitesDir, conversionData.siteName, 'input', 'config', 'pages.config.json');
108108
let pagesHierarchy = JSON.parse(FileHelper.readFileSync(pagesFile, { encoding: 'utf8' }));
109109

110-
for (let i = 0; i < postIDs.length; i++) {
110+
for (let i = 0; i < conversionData.postIDs.length; i++) {
111111
pagesHierarchy.push({
112-
id: postIDs[i],
112+
id: conversionData.postIDs[i],
113113
subpages: []
114114
});
115115
}

app/back-end/events/preview.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,13 @@ class PreviewEvents {
8585
errorTitle = {
8686
translation: 'core.rendering.renderingProcessFailed'
8787
};
88-
errorDesc = data.result[0].message + "\n\n" + data.result[0].desc;
89-
}
90-
91-
if (typeof errorDesc === 'object') {
92-
errorDesc = errorDesc.translation;
88+
errorDesc = stripTags((data.result[0].message + "\n\n" + data.result[0].desc).toString());
9389
}
9490

9591
event.sender.send('app-preview-render-error', {
9692
message: [{
9793
message: errorTitle,
98-
desc: stripTags((errorDesc).toString())
94+
desc: errorDesc
9995
}]
10096
});
10197
}
@@ -134,7 +130,7 @@ class PreviewEvents {
134130
errorTitle = {
135131
translation: 'core.rendering.renderingProcessFailed'
136132
};
137-
errorDesc = data.result[0].message + "\n\n" + data.result[0].desc;
133+
errorDesc = stripTags((data.result[0].message + "\n\n" + data.result[0].desc).toString());
138134
}
139135

140136
event.sender.send('app-preview-render-error', {

app/back-end/modules/render-html/handlebars/helpers/_modules.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module.exports = {
77
fontHelper: require('./font.js').fontHelper,
88
dateHelper: require('./date.js'),
99
is: require('./is.js'),
10+
isNot: require('./is-not.js'),
1011
isCurrentPage: require('./is-current-page.js'),
1112
encodeUrl: require('./encode-url.js'),
1213
encodeUrlFragment: require('./encode-url-fragment.js'),
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* Helper for detecting contexts - opposite to #is helper
3+
*
4+
* {{#isNot 'index'}}
5+
*
6+
* {{#isNot 'tag,post'}}
7+
*
8+
* Available phrases: index, blogindex, tag, post, page, author, 404, search, pagination, index-pagination, tag-pagination, author-pagination
9+
*
10+
* @returns {callback}
11+
*/
12+
function isNot (conditional, options) {
13+
let contextIsCorrect = false;
14+
let contextsToCheck = conditional.split(',');
15+
contextsToCheck = contextsToCheck.map(context => context.trim());
16+
17+
for (let context of contextsToCheck) {
18+
if (options.data.context.indexOf(context) > -1) {
19+
contextIsCorrect = true;
20+
break;
21+
}
22+
}
23+
24+
if (!contextIsCorrect) {
25+
return options.fn(this);
26+
} else {
27+
return options.inverse(this);
28+
}
29+
}
30+
31+
module.exports = isNot;

app/back-end/modules/render-html/renderer-cache.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ class RendererCache {
124124
WHERE
125125
p.status LIKE '%published%' AND
126126
p.status NOT LIKE '%hidden%' AND
127-
p.status NOT LIKE '%trashed%'
127+
p.status NOT LIKE '%trashed%' AND
128+
p.status NOT LIKE '%is-page%'
128129
${includeFeaturedPosts}
129130
GROUP BY
130131
pt.tag_id;
@@ -238,7 +239,7 @@ class RendererCache {
238239
p.status LIKE '%published%' AND
239240
p.status NOT LIKE '%hidden%' AND
240241
p.status NOT LIKE '%trashed%' AND
241-
p.status NOT LIKE '%is-page%'
242+
p.status NOT LIKE '%is-page%'
242243
${includeFeaturedPosts}
243244
GROUP BY
244245
a.id

app/back-end/modules/render-html/renderer-context.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,15 @@ class RendererContext {
782782
return this.siteConfig.domain + '/';
783783
}
784784

785+
if (
786+
!this.renderer.cachedItems ||
787+
!this.renderer.cachedItems.pages ||
788+
!this.renderer.cachedItems.pages[itemContext.page.id] ||
789+
!this.renderer.cachedItems.pages[itemContext.page.id].url
790+
) {
791+
return this.siteConfig.domain + '/' + itemSlug + '/';
792+
}
793+
785794
return this.renderer.cachedItems.pages[itemContext.page.id].url;
786795
}
787796
}

0 commit comments

Comments
 (0)