Skip to content

Commit

Permalink
fixed issue when updating files in subweb + some mods in gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomi Tavela authored and Tomi Tavela committed Sep 10, 2017
1 parent 4a139ea commit fcb29c7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
14 changes: 7 additions & 7 deletions app/panelspqueries.js
Expand Up @@ -1578,19 +1578,19 @@ var updateEditorFile = function updateEditorFile() {
// todo: add checkin type
// todo: figure out why files in Forms folder doent want to checkin, update ok

$pnp.sp.site.rootWeb.getFileByServerRelativeUrl(fileUrl).get().then(r => {
$pnp.sp.web.getFileByServerRelativeUrl(fileUrl).get().then(r => {
if (r.CustomizedPageStatus > 0) {
$pnp.sp.site.rootWeb.getFileByServerRelativeUrl(fileUrl).setContent(fileContent).then(f => {
$pnp.sp.web.getFileByServerRelativeUrl(fileUrl).setContent(fileContent).then(f => {
window.postMessage(JSON.stringify({ function: "updateEditorFile", success: true, result: null, source: 'chrome-sp-editor' }), '*');
}).catch(function (error) {
alert(error.data.responseBody.error.message.value);
window.postMessage(JSON.stringify({ function: "updateEditorFile", success: false, result: null, source: 'chrome-sp-editor' }), '*');
});
}
else if (r.CheckOutType == 2) {
$pnp.sp.site.rootWeb.getFileByServerRelativeUrl(fileUrl).checkout().then(f => {
$pnp.sp.site.rootWeb.getFileByServerRelativeUrl(fileUrl).setContent(fileContent).then(f => {
$pnp.sp.site.rootWeb.getFileByServerRelativeUrl(fileUrl).checkin("Updated from SP Editor", fileCheckinType).then(f => {
$pnp.sp.web.getFileByServerRelativeUrl(fileUrl).checkout().then(f => {
$pnp.sp.web.getFileByServerRelativeUrl(fileUrl).setContent(fileContent).then(f => {
$pnp.sp.web.getFileByServerRelativeUrl(fileUrl).checkin("Updated from SP Editor", fileCheckinType).then(f => {
window.postMessage(JSON.stringify({ function: "updateEditorFile", success: true, result: null, source: 'chrome-sp-editor' }), '*');
}).catch(function (error) {
alert(error.data.responseBody.error.message.value);
Expand All @@ -1605,8 +1605,8 @@ var updateEditorFile = function updateEditorFile() {
window.postMessage(JSON.stringify({ function: "updateEditorFile", success: false, result: null, source: 'chrome-sp-editor' }), '*');
});
} else {
$pnp.sp.site.rootWeb.getFileByServerRelativeUrl(fileUrl).setContent(fileContent).then(f => {
$pnp.sp.site.rootWeb.getFileByServerRelativeUrl(fileUrl).checkin("Updated from SP Editor", fileCheckinType).then(f => {
$pnp.sp.web.getFileByServerRelativeUrl(fileUrl).setContent(fileContent).then(f => {
$pnp.sp.web.getFileByServerRelativeUrl(fileUrl).checkin("Updated from SP Editor", fileCheckinType).then(f => {
window.postMessage(JSON.stringify({ function: "updateEditorFile", success: true, result: null, source: 'chrome-sp-editor' }), '*');
}).catch(function (error) {
alert(error.data.responseBody.error.message.value);
Expand Down
5 changes: 0 additions & 5 deletions docs/README.md
@@ -1,8 +1,3 @@
<header>
<h1> SP Editor</h1>

A Google Chrome Extension for creating and updating files (js, css) in SharePoint Online from Chrome Developer Tools
</header>
Here's a great introduction video by [Jeff Jones](http://www.spjeff.com/2017/04/24/video-sp-editor-chrome-extension)


Expand Down
2 changes: 1 addition & 1 deletion docs/_config.yml
@@ -1,4 +1,4 @@
title: SP Editor
description: A Google Chrome Extension for creating and updating files (js, css) in SharePoint Online from Chrome Developer Tools
description: Your Modern SharePoint Designer (2013/2016/O365) baked in Google Chrome browser!
show_downloads: false
theme: jekyll-theme-slate

0 comments on commit fcb29c7

Please sign in to comment.