Page tree

Versions Compared

Key

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

Status
colourYellow
title릴리즈 2.10.0 이상

붙여넣기 전에 발생합니다. 이 이벤트를 통해 클립보드 Data를 전달받아서 setContentsToPaste 함수를 통해 수정된 HTML을 붙여넣을 수 있습니다.

...

This event occurs before pasting. Clipboard data is received through this event, and modified HTML can be pasted through the setContentsToPaste function.

Adding Event: Using API

Code Block
languagejs
var editorId = 'synapEditor';
var editorConfig = {};
var html = '';
var editor = new SynapEditor(editorId, editorConfig, html);

editor.setEventListener('beforePaste', function (e) {
});

...

Adding Event:

...

Function

Code Block
languagejs
var editorId = 'synapEditor';
var editorConfig = {};
var html = '';

function SynapEditorBeforePaste(e) {
	var editor = e.editor;
	var html = e.clipboardData.html;
	// 필요한 클립보드 DATA 처리
	editor.setContentsToPaste(html);
}

new SynapEditor(editorId, editorConfig, html);

...

Adding Event: When the Editor is initialized

Code Block
languagejs
var editorId = 'synapEditor';
var editorConfig = {};
var html = '';
var eventListeners = {
    beforePaste: function (e) {
		var editor = e.editor;
		var html = e.clipboardData.html;
		// 필요한 클립보드 DATA 처리
		editor.setContentsToPaste(html);
    }
};

new SynapEditor(editorId, editorConfig, html, eventListeners);

함수로 전달되는 객체 형태

...

Object Delivered through Functions

In the form of parameter e delivered through functions

Code Block
languagejs
titlee
{
	editor: SynapEditor,
	clipboardData: {
		files: [],
		html: '',
		rtf: '',
		text: ''
	},
	eventType:  'beforePaste',
	cancelable: false,
	returnValue: null
}

...