Skip to content

Commit

Permalink
Fix shared property page wrong content when switching document
Browse files Browse the repository at this point in the history
  • Loading branch information
dgthanhan committed Dec 31, 2022
1 parent e6e534d commit 19e9e98
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 5 additions & 3 deletions app/pencil-core/common/DocumentHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ DocumentHandler.prototype.loadDocumentFromArguments = function (filePath) {
FontLoader.instance.loadFonts();
this.controller.handleNewDocumentFromImage(filePath);
}

}

DocumentHandler.prototype.pickupTargetFileToSave = function (callback) {
Expand Down Expand Up @@ -269,7 +269,7 @@ DocumentHandler.prototype.newDocument = function () {
parentPageId: null,
activateAfterCreate: "activatePage"
};

var page = thiz.controller.newPage(options);
thiz.controller.modified = false;
}, 50);
Expand All @@ -296,9 +296,11 @@ DocumentHandler.prototype.resetDocument = function () {

this.controller.applicationPane.pageListView.currentParentPage = null;
FontLoader.instance.setDocumentRepoDir(path.join(this.tempDir.name, "fonts"));

if (StencilCollectionBuilder.activeCollectionInfo) {
StencilCollectionBuilder.cleanup();
CollectionManager.reloadActiveBuilderCollection();
}

Pencil.invalidateSharedEditor();
};
1 change: 0 additions & 1 deletion app/pencil-core/common/pencil.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ Pencil.boot = function (event) {
};
Pencil.handleArguments = function() {
var appArguments = remote.getGlobal('sharedObject').appArguments;
console.log("appArguments", appArguments);
if (appArguments && appArguments.length > 1) {
var filePath = null;
for (var i = 1; i < appArguments.length; i ++) {
Expand Down
3 changes: 3 additions & 0 deletions app/views/PageDetailDialog.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
align-items: center;
margin-top: 0.5em;
}
@copyLinksBox > * + * {
margin-left: 0.5em;
}
@colorButton {
margin-left: 0.5em;
}
Expand Down
8 changes: 2 additions & 6 deletions app/views/editors/SharedPropertyEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ SharedPropertyEditor.prototype.setup = function () {

thiz.validationEditorUI();
}, false);
this.propertyContainer.style.display = "none";
this.node().setAttribute("mode", "None");

this.propertyContainer.addEventListener("click", function(event) {
if (event.target.getAttribute("command") && event.target.getAttribute("command") == "setDefault") {
Expand Down Expand Up @@ -149,9 +149,7 @@ SharedPropertyEditor.prototype.attach = function (target) {
var thiz = this;
var currentGroupNode = null;

this.propertyContainer.style.display = "none";
this.propertyContainer.style.opacity = "0";
this.noTargetMessagePane.style.display = "none";

var uuid = Util.newUUID();
this.currentExecutorUUID = uuid;
Expand Down Expand Up @@ -195,7 +193,6 @@ SharedPropertyEditor.prototype.attach = function (target) {
}, document, thiz));
}

thiz.propertyContainer.style.display = "flex";
thiz.propertyContainer.style.opacity = "1";
thiz.validationEditorUI();
return;
Expand Down Expand Up @@ -311,7 +308,7 @@ SharedPropertyEditor.prototype.addPropertyTitle = function (title) {
SharedPropertyEditor.prototype.detach = function () {
this.propertyContainer.innerHTML = "";
this.target = null;
if (Pencil.controller.activePage) {
if (Pencil.controller.doc && Pencil.controller.activePage) {
this.node().setAttribute("mode", "Page");
this.addPropertyTitle(Pencil.controller.activePage.name);
this.pagePropertyWidget = new PageDetailDialog();
Expand All @@ -328,7 +325,6 @@ SharedPropertyEditor.prototype.detach = function () {
Dom.emitEvent("p:TitleChanged", this.node(), {});
};
SharedPropertyEditor.prototype.savePageProperties = function (shouldReloadOnSaved) {
console.log("savePageProperties");
if (!this.isPagePropertyMode()) return;
if (!this.pagePropertyWidget.isPageInfoValid()) {
this.pagePropertyWidget.setup({
Expand Down

0 comments on commit 19e9e98

Please sign in to comment.