Skip to content

Commit c394ab3

Browse files
authored
Merge pull request #306 from AyshaHakeem/fix-draft
fix: display draft and contributions content
2 parents 8b157ac + 3dfc520 commit c394ab3

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

wiki/public/js/editor.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ editWikiBtn.on("click", () => {
2727

2828
$(document).ready(() => {
2929
const urlParams = new URLSearchParams(window.location.search);
30-
if (urlParams.get("editWiki") === "1") {
30+
if (urlParams.get("editWiki") || urlParams.get("wikiPagePatch")) {
3131
setEditor();
3232
}
3333
});
@@ -55,6 +55,7 @@ previewToggleBtn.on("click", function () {
5555
});
5656

5757
function setEditor() {
58+
const urlParams = new URLSearchParams(window.location.search);
5859
editor.setOptions({
5960
wrap: true,
6061
showPrintMargin: true,
@@ -65,9 +66,10 @@ function setEditor() {
6566
method: "wiki.wiki.doctype.wiki_page.wiki_page.get_markdown_content",
6667
args: {
6768
wikiPageName,
69+
wikiPagePatch: urlParams.get("wikiPagePatch") || "",
6870
},
6971
callback: (r) => {
70-
editor.setValue(r.message || "", 1);
72+
editor.setValue(r.message.content || "", 1);
7173
},
7274
});
7375
wikiTitleInput.val($(".wiki-title").text() || "");

wiki/wiki/doctype/wiki_page/wiki_page.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -599,5 +599,8 @@ def update_page_settings(name, settings):
599599

600600

601601
@frappe.whitelist()
602-
def get_markdown_content(wikiPageName):
603-
return frappe.db.get_value("Wiki Page", wikiPageName, "content")
602+
def get_markdown_content(wikiPageName, wikiPagePatch):
603+
if wikiPagePatch:
604+
new_code, new_title = frappe.db.get_value("Wiki Page Patch", wikiPagePatch, ["new_code", "new_title"])
605+
return {"content": new_code, "title": new_title}
606+
return frappe.db.get_value("Wiki Page", wikiPageName, ["content", "title"], as_dict=True)

0 commit comments

Comments
 (0)