Skip to content

Commit 3be511d

Browse files
committed
Change data transfered by file navigation trigger
1 parent 7d09a95 commit 3be511d

3 files changed

Lines changed: 22 additions & 15 deletions

File tree

src/api_block/init.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ define([
713713
*/
714714
$(document).on("fileReadSelected.fileNavigation", function(e) {
715715
// 선택 파일 확장자가 노트 세이브 파일인 경우만 동작
716-
if (e.path.substring(e.path.lastIndexOf(".") + 1) === vpConst.VP_NOTE_EXTENSION) {
716+
if (e.file.substring(e.file.lastIndexOf(".") + 1) === vpConst.VP_NOTE_EXTENSION) {
717717
openNotePageAction_newVersion();
718718
}
719719
});
@@ -723,7 +723,7 @@ define([
723723
*/
724724
$(document).on("fileSaveSelected.fileNavigation", function(e) {
725725
// 선택 파일 확장자가 노트 세이브 파일인 경우만 동작
726-
if (e.path.substring(e.path.lastIndexOf(".") + 1) === vpConst.VP_NOTE_EXTENSION) {
726+
if (e.file.substring(e.file.lastIndexOf(".") + 1) === vpConst.VP_NOTE_EXTENSION) {
727727
var selectedPath = $(vpCommon.wrapSelector(vpCommon.formatString("#{0}", vpConst.VP_NOTE_REAL_FILE_PATH))).val();
728728
var saveFileName = selectedPath.substring(selectedPath.lastIndexOf("/") + 1);
729729
// FIXME: 여기부분 수정해야 함

src/file_io/udf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ define([
497497

498498
// export complete event
499499
$(document).on('snippetSaved.fileNavigation', this.wrapSelector('.vp-sn-filepath'), function(evt) {
500-
var fileName = evt.path;
500+
var fileName = evt.file;
501501
var selectedPath = $(this).val();
502502

503503
// get checked snippets

src/pandas/fileNavigation/renderer.js

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -394,29 +394,33 @@ define([
394394
/** 최초의 path가 C:/Users/L.E.E/Desktop/Bit Python이라면, baseFolder는 Bit Python
395395
* 현재 이동한 시점의 path에서 baseFolder인 Bit Python가 존재하지 않을 때
396396
*/
397+
var pathInput = '';
398+
var fileInput = `${filePathStr}`;
397399
if (upDirectoryCount > 0
398400
&& currentDirStr.indexOf(baseFolder) === -1) {
399401
/** 2020년 12월 21일 single quote 삭제 */
400-
$(fileNavigationRendererThis.fileResultState.pathInputId).val(`${prefixUpDirectory}${relativeDirPath}${slashstr}${filePathStr}`);
401-
$(fileNavigationRendererThis.fileResultState.fileInputId).val(`${filePathStr}`);
402-
/** 현재 이동한 시점의 path에서 baseFolder인 Bit Python가 존재할 때 */
402+
pathInput = `${prefixUpDirectory}${relativeDirPath}${slashstr}${filePathStr}`;
403+
/** 현재 이동한 시점의 path에서 baseFolder인 Bit Python가 존재할 때 */
403404
} else {
404-
$(fileNavigationRendererThis.fileResultState.pathInputId).val(`./${relativeDirPath}${slashstr}${filePathStr}`);
405-
$(fileNavigationRendererThis.fileResultState.fileInputId).val(`${filePathStr}`);
405+
pathInput = `./${relativeDirPath}${slashstr}${filePathStr}`;
406406
}
407+
$(fileNavigationRendererThis.fileResultState.pathInputId).val(pathInput);
408+
$(fileNavigationRendererThis.fileResultState.fileInputId).val(fileInput);
407409

408410
// vpCommon.renderSuccessMessage(filePathStr + ' selection ' + 'completed');
409411

410412
/** 장안태 추가. 파일 선택 완료시 문서 이벤트 발동 */
411413
if (fileNavigationState.getFileNavigationtype() === FILE_NAVIGATION_TYPE.SAVE_FILE) {
412414
$(document).trigger({
413-
type:"fileSaveSelected.fileNavigation",
414-
path:`${filePathStr}`
415+
type: "fileSaveSelected.fileNavigation",
416+
file: fileInput,
417+
path: pathInput
415418
});
416419
} else {
417420
$(document).trigger({
418-
type:"fileReadSelected.fileNavigation",
419-
path:`${filePathStr}`
421+
type: "fileReadSelected.fileNavigation",
422+
file: fileInput,
423+
path: pathInput
420424
});
421425
}
422426

@@ -425,22 +429,25 @@ define([
425429
if (fileNavigationState.getFileNavigationtype() === FILE_NAVIGATION_TYPE.READ_IMG_FOR_MARKDOWN) {
426430
$(document).trigger({
427431
type: fileNavigationState.getTriggerName(),
428-
path: `${filePathStr}`
432+
file: fileInput,
433+
path: pathInput
429434
})
430435
}
431436

432437
/** Snippets 저장 후 이벤트 발동 */
433438
if (fileNavigationState.getFileNavigationtype() === FILE_NAVIGATION_TYPE.SAVE_SNIPPETS) {
434439
$(fileNavigationRendererThis.fileResultState.pathInputId).trigger({
435440
type: 'snippetSaved.fileNavigation',
436-
path:`${filePathStr}`
441+
file: fileInput,
442+
path: pathInput
437443
});
438444
}
439445
/** Snippets 불러오기 후 이벤트 발동 */
440446
if (fileNavigationState.getFileNavigationtype() === FILE_NAVIGATION_TYPE.READ_SNIPPETS) {
441447
$(fileNavigationRendererThis.fileResultState.pathInputId).trigger({
442448
type: 'snippetRead.fileNavigation',
443-
path:`${filePathStr}`
449+
file: fileInput,
450+
path: pathInput
444451
});
445452
}
446453

0 commit comments

Comments
 (0)