From 7bd480b1b0688282968dc636660a882a1f690b71 Mon Sep 17 00:00:00 2001 From: "T. Chojnacki" Date: Sun, 12 Aug 2018 11:20:25 +0200 Subject: [PATCH] Fix for creating new pages --- editor.js | 3 +++ manifest.json | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/editor.js b/editor.js index ee21909..fc4fed1 100644 --- a/editor.js +++ b/editor.js @@ -48,6 +48,9 @@ class FMEditor { } async getPageContent (newest) { + if (this.bgData.revid === 0) { + return '' + } const response = await window.fetch(`${this.bgData.api}/api.php?format=json&action=query&prop=revisions&rvprop=content&` + (newest ? `titles=${this.bgData.title}&cb=${new Date().getTime() / 1000}` : `revids=${this.bgData.revid}`)) const json = await response.json() const content = json.query.pages[Object.keys(json.query.pages)[0]].revisions ? json.query.pages[Object.keys(json.query.pages)[0]].revisions[0]['*'] : '' diff --git a/manifest.json b/manifest.json index 7c2021a..745b53e 100644 --- a/manifest.json +++ b/manifest.json @@ -7,7 +7,7 @@ }, "manifest_version": 2, "name": "FANDOM Monaco", - "version": "1.2.1", + "version": "1.2.2", "description": "Integrate Monaco Editor into FANDOM.", "background": { "scripts": [