v7.3.0

EventCopyPaste
Feature

Allow using Ctrl/Cmd+C, Ctrl/Cmd+X and Ctrl/Cmd+V to copy/cut and paste events.

This feature also adds entries to the EventMenu for copying & cutting (see example below for how to configure) and to the ScheduleMenu for pasting.

You can configure how a newly pasted record is named using generateNewName.

If you want to highlight the paste location when clicking in the schedule, consider enabling the ScheduleContext feature.

When used with Scheduler Pro, pasting will bypass any constraint set on the event to allow the copy to be assigned the targeted date.

This feature is enabled by default.

Customize menu items

See EventMenu and ScheduleMenu for more info on customizing the menu items supplied by the feature. This snippet illustrates the concept:

// Custom copy text + remove cut option from event menu:
const scheduler = new Scheduler({
    features : {
        eventMenu : {
            items : {
                copyEvent : {
                    text : 'Copy booking'
                },
                cutEvent  : false
            }
        }
    }
});

Keyboard shortcuts

The feature has the following default keyboard shortcuts:

Keys Action Action description
Ctrl+C copy Copies selected event(s) into the clipboard.
Ctrl+X cut Cuts out selected event(s) into the clipboard.
Ctrl+V paste Insert copied or cut event(s) from the clipboard.

Please note that Ctrl is the equivalent to Command and Alt is the equivalent to Option for Mac users

For more information on how to customize keyboard shortcuts, please see our guide.

Multi assigned events

In a Scheduler that uses single assignment, copying and then pasting creates a clone of the event and assigns it to the target resource. Cutting and pasting moves the original event to the target resource.

In a Scheduler using multi assignment, the behaviour is slightly more complex. Cutting and pasting reassigns the event to the target, keeping other assignments of the same event intact. The behaviour for copying and pasting is configurable using the copyPasteAction config. It accepts two values:

  • 'clone' - The default, the event is cloned and the clone is assigned to the target resource. Very similar to the behaviour with single assignment (event count goes up by 1).
  • 'assign' - The original event is assigned to the target resource (event count is unaffected).

This snippet shows how to reconfigure it:

const scheduler = new Scheduler({
    features : {
        eventCopyPaste : {
            copyPasteAction : 'assign'
        }
    }
});
Copying multiple assignments of the same event will always result in all but the first assignment being removed on paste, since paste targets a single resource and an event can only be assigned to a resource once.

Native/shared clipboard

If you have multiple Schedulers (or other Bryntum products) on the same page, they will share clipboard. This makes it possible to copy and paste between different Scheduler instances. It is also possible to use the native Clipboard API if it is available and if you set useNativeClipboard to true.

Regardless of native clipboard availability, copy-pasting "outside" of the current Scheduler instance will convert the copied events to a string. When pasting, the string will then be parsed back into events. In case of usage of the native Clipboard API, this means it is possible to copy and paste events between completely different applications.

To configure the fields that is converted and parsed from the copied string value, please see the eventToStringFields config.

Useful configs and functions

Member Description
beforeCopy Fires before copy, return false to prevent
copy Fires when events are copied
beforePaste Fires before paste, return false to prevent
paste Fires when events are pasted

See also

No results

Configs

Configs are options you supply in a configuration object when creating an instance of this class
  • The field to use as the name field when updating the name of copied records

  • By default, pasting of multiple events will spread out according to the pattern it was copied. Set to false to paste into the same resource and same date.

Properties

Properties are getters/setters or publicly accessible variables on this class

Functions

Functions are methods available for calling on the class

    Events

    Events are triggered for certain actions in this class and can be listened for to react to those actions in your code

    Event handlers

    Event handlers are callbacks called as a result of certain actions in this class
    id: eventCopyPaste

    Source path

    Scheduler/feature/EventCopyPaste.js

    Contents