Skip to content

Commit cd2f7b7

Browse files
committed
Confirmation added before New Note operation
1 parent 690795f commit cd2f7b7

2 files changed

Lines changed: 18 additions & 18 deletions

File tree

src/api_block/component/boardMenuBar.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ define([
3232
, STR_OPACITY
3333
, STR_UNTITLED } = constData;
3434

35-
const { saveNotePageAction_newVersion } = vpContainer;
35+
const { saveAsNotePage, saveNotePageAction_newVersion } = vpContainer;
3636

3737
var apiBlockMenuInit = function(blockContainer) {
3838
var apiBlockMenuBarDom;
@@ -144,34 +144,40 @@ define([
144144
$(apiBlockMenuBarDom).remove();
145145

146146
var blockList = blockContainer.getBlockList();
147-
if (blockList.length == 0) {
148-
return;
149-
}
147+
// if (blockList.length == 0) {
148+
// return;
149+
// }
150150

151151
/** 빈 string이거나
152152
* Untitled이면 File navigation을 open */
153153
var saveFileName = $(VP_ID_PREFIX + VP_ID_APIBLOCK_BOARD_MAKE_NODE_BLOCK_INPUT).val();
154-
if ( saveFileName == STR_EMPTY
155-
|| saveFileName == STR_UNTITLED) {
154+
if ( blockList.length == 0
155+
&& (saveFileName == STR_EMPTY
156+
|| saveFileName == STR_UNTITLED)) {
156157
blockContainer.deleteAllBlock();
157158
blockContainer.setIsMenubarOpen(false);
158159
return;
159160
}
160161

161-
var saveFilePath = vpCommon.formatString("./{0}.{1}", saveFileName, vpConst.VP_NOTE_EXTENSION);
162+
var saveFilePath = $(vpCommon.wrapSelector(vpCommon.formatString("#{0}", vpConst.VP_NOTE_REAL_FILE_PATH))).val();
162163
var apiBlockPackage = blockContainer.getImportPackageThis();
163164
apiBlockPackage.openMultiBtnModal_new('Save As', `Save changes to '${saveFileName}.vp'`,['Yes', 'No', 'Cancel'], [() => {
164-
saveNotePageAction_newVersion(vpCommon.formatString("{0}.{1}", saveFileName, vpConst.VP_NOTE_EXTENSION), saveFilePath);
165+
if (saveFilePath == '') {
166+
saveAsNotePage();
167+
} else {
168+
vpCommon.formatString("./{0}.{1}", saveFileName, vpConst.VP_NOTE_EXTENSION);
169+
saveNotePageAction_newVersion(vpCommon.formatString("{0}.{1}", saveFileName, vpConst.VP_NOTE_EXTENSION), saveFilePath);
170+
}
165171

166172
blockContainer.deleteAllBlock();
167173
// clear file and path
168-
$('#vp_apiblock_board_makenode_input').val('Untitled');
174+
$('#vp_apiblock_board_makenode_input').val(STR_UNTITLED);
169175
$('#vp_apiblock_board_makenode_path').val('');
170176

171177
},() => {
172178
blockContainer.deleteAllBlock();
173179
// clear file and path
174-
$('#vp_apiblock_board_makenode_input').val('Untitled');
180+
$('#vp_apiblock_board_makenode_input').val(STR_UNTITLED);
175181
$('#vp_apiblock_board_makenode_path').val('');
176182

177183
},() => {

src/api_block/init.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ define([
553553
// });
554554
});
555555

556-
/** +node 블럭 생성 버튼 클릭 함수 바인딩 */
556+
/** +code 블럭 생성 버튼 클릭 함수 바인딩 */
557557
$(document).on(STR_CLICK, VP_ID_PREFIX + VP_ID_APIBLOCK_NODE_BLOCK_PLUS_BUTTON, function() {
558558
// blockContainer.createNodeBlock(true);
559559
// +code 블럭 생성
@@ -729,14 +729,8 @@ define([
729729
if (e.file.substring(e.file.lastIndexOf(".") + 1) === vpConst.VP_NOTE_EXTENSION) {
730730
var selectedPath = $(vpCommon.wrapSelector(vpCommon.formatString("#{0}", vpConst.VP_NOTE_REAL_FILE_PATH))).val();
731731
var saveFileName = selectedPath.substring(selectedPath.lastIndexOf("/") + 1);
732-
// FIXME: 여기부분 수정해야 함
733-
saveNotePageAction_newVersion(saveFileName, selectedPath);
734-
// apiBlockPackage.openMultiBtnModal_new('Save As', `Save changes to '${saveFileName}'`,['Yes','No', 'Cancel'], [() => {
735-
// },() => {
736-
737-
// },() => {
738732

739-
// }]);
733+
saveNotePageAction_newVersion(saveFileName, selectedPath);
740734
}
741735
});
742736

0 commit comments

Comments
 (0)