Page tree
Skip to end of metadata
Go to start of metadata

RELEASE 2.10.0 OR ABOVE

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

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

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

Adding Event: Function

var editorId = 'synapEditor';
var editorConfig = {};
var html = '';

function SynapEditorBeforePaste(e) {
	var editor = e.editor;
	var html = e.clipboardData.html;
	// Processes the required clipboard data.
	editor.setContentsToPaste(html);
}

new SynapEditor(editorId, editorConfig, html);

Adding Event: When the Editor is initialized

var editorId = 'synapEditor';
var editorConfig = {};
var html = '';
var eventListeners = {
    beforePaste: function (e) {
		var editor = e.editor;
		var html = e.clipboardData.html;
		// Processes the required clipboard data.
		editor.setContentsToPaste(html);
    }
};

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

Object Delivered through Functions

In the form of parameter e delivered through functions

e
{
	editor: SynapEditor,
	clipboardData: {
		files: [],
		html: '',
		rtf: '',
		text: ''
	},
	eventType:  'beforePaste',
	cancelable: false,
	returnValue: null
}
  • No labels