Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
themeEmacs
title에디터 설정
//...
'editor.menu.definition': {
	//...,
	'tools': [
		//...,
		'documentComparison',
		//...
	],
	//...
},
//...

플러그인 설정하기

사용 가능한 키

Key


Type

필수

설명

list

url

string

O

  • 요청을 보낼 URL을 설정합니다.

    • 저장된 문서 목록 리스트를 가져오는 API 주소

  • 설정이 되지 않으면 문서 이력 플러그인이 동작하지 않습니다.

headers

string


  • 요청을 보낼 헤더를 설정합니다.

params

string

O
  • 요청을 보낼 때 함께 보낼 기본 파라미터를 설정합니다.

dataurlstringO
  • 요청을 보낼 URL을 설정합니다.

    • 저장된 문서 목록 리스트 중 하나의 데이터를 가져오는 API 주소

  • 설정이 되지 않으면 문서 이력 플러그인이 동작하지 않습니다.

headersstring
  • 요청을 보낼 헤더를 설정합니다.
paramsstring
  • 요청을 보낼 때 함께 보낼 기본 파라미터를 설정합니다.
paramKeystring
  • 요청을 보낼 때 함께 보낼 파라미터의 Key 값을 설정합니다.

...

Code Block
languagejs
themeEmacs
title에디터 설정
'documentComparison.config': {
        'list': { // 저장된 문서 목록 리스트에 대한 config 설정입니다.
            'url': '/getDocumentVersionList',
            'headers': {},
            'params': {}
        },
        'data': { // 저장된 문서 목록 중 하나의 데이터에 대한 config 설정입니다.
            'url': '/getDocumentVersionData', 
            'headers': {},
            'params': {},
            'paramKey': ''
        }
    }

API 예제 코드:

Code Block
languagejs
themeEmacs
titleexample
    /**
     * 문서 버전 목록 가져오기
     */
    getDocumentVersionList: async (req, res) => {
        const id = _.get(req, ['body', 'id']);
        const results = await versionQueryManager.getVersions(id);

        const formattedData = results.map((result, index) => {
            return {
                id: result._id,
                date: result.createdAt,
                author: '' // 작성자 정보 값 설정
            };
        });
        res.json(formattedData);
    }

    /**
     * 문서 버전 데이터 가져오기
     */
    getDocumentVersionData: async (req, res) => {
        const id = _.get(req, ['body', 'id']);
        const result = await versionQueryManager.getData(id);
        res.json(result.json);
    }

...