提交 f5aa82d2 编写于 作者: R rebornix

put drag and drop behind an option and turn it off by default

上级 381d8bfc
......@@ -429,7 +429,8 @@ class MouseDownOperation extends Disposable {
// Overwrite the detail of the MouseEvent, as it will be sent out in an event and contributions might rely on it.
e.detail = this._mouseState.count;
if (!this._mouseState.altKey // we don't support multiple mouse
if (this._context.configuration.editor.enableDragAndDrop
&& !this._mouseState.altKey // we don't support multiple mouse
&& e.detail < 2 // only single click on a selection can work
&& !this._isActive // the mouse is not down yet
&& !this._currentSelection.isEmpty() // we don't drag single cursor
......
......@@ -317,6 +317,7 @@ class InternalEditorOptionsHelper {
autoClosingBrackets: toBoolean(opts.autoClosingBrackets),
useTabStops: toBoolean(opts.useTabStops),
tabFocusMode: tabFocusMode,
enableDragAndDrop: toBoolean(opts.enableDragAndDrop),
layoutInfo: layoutInfo,
fontInfo: fontInfo,
viewInfo: viewInfo,
......@@ -842,6 +843,11 @@ const editorConfiguration: IConfigurationNode = {
'default': false,
'description': nls.localize('stablePeek', "Keep peek editors open even when double clicking their content or when hitting Escape.")
},
'editor.enableDragAndDrop': {
'type': 'boolean',
'default': DefaultConfig.editor.enableDragAndDrop,
'description': nls.localize('enableDragAndDrop', "Controls if the editor should allow to move selections via drag and drop.")
},
'diffEditor.renderSideBySide': {
'type': 'boolean',
'default': true,
......
......@@ -106,6 +106,7 @@ class ConfigClass implements IConfiguration {
renderLineHighlight: 'line',
useTabStops: true,
matchBrackets: true,
enableDragAndDrop: false,
fontFamily: (
platform.isMacintosh ? DEFAULT_MAC_FONT_FAMILY : (platform.isLinux ? DEFAULT_LINUX_FONT_FAMILY : DEFAULT_WINDOWS_FONT_FAMILY)
......
......@@ -419,6 +419,11 @@ export interface IEditorOptions {
* Defaults to false.
*/
formatOnPaste?: boolean;
/**
* Controls if the editor should allow to move selections via drag and drop.
* Defaults to false.
*/
enableDragAndDrop?: boolean;
/**
* Enable the suggestion box to pop-up on trigger characters.
* Defaults to true.
......@@ -1068,6 +1073,7 @@ export class InternalEditorOptions {
readonly autoClosingBrackets: boolean;
readonly useTabStops: boolean;
readonly tabFocusMode: boolean;
readonly enableDragAndDrop: boolean;
// ---- grouped options
readonly layoutInfo: EditorLayoutInfo;
readonly fontInfo: FontInfo;
......@@ -1085,6 +1091,7 @@ export class InternalEditorOptions {
autoClosingBrackets: boolean;
useTabStops: boolean;
tabFocusMode: boolean;
enableDragAndDrop: boolean;
layoutInfo: EditorLayoutInfo;
fontInfo: FontInfo;
viewInfo: InternalEditorViewOptions;
......@@ -1097,6 +1104,7 @@ export class InternalEditorOptions {
this.autoClosingBrackets = Boolean(source.autoClosingBrackets);
this.useTabStops = Boolean(source.useTabStops);
this.tabFocusMode = Boolean(source.tabFocusMode);
this.enableDragAndDrop = Boolean(source.enableDragAndDrop);
this.layoutInfo = source.layoutInfo.clone();
this.fontInfo = source.fontInfo.clone();
this.viewInfo = source.viewInfo.clone();
......@@ -1115,6 +1123,7 @@ export class InternalEditorOptions {
&& this.autoClosingBrackets === other.autoClosingBrackets
&& this.useTabStops === other.useTabStops
&& this.tabFocusMode === other.tabFocusMode
&& this.enableDragAndDrop === other.enableDragAndDrop
&& this.layoutInfo.equals(other.layoutInfo)
&& this.fontInfo.equals(other.fontInfo)
&& this.viewInfo.equals(other.viewInfo)
......@@ -1134,6 +1143,7 @@ export class InternalEditorOptions {
autoClosingBrackets: (this.autoClosingBrackets !== newOpts.autoClosingBrackets),
useTabStops: (this.useTabStops !== newOpts.useTabStops),
tabFocusMode: (this.tabFocusMode !== newOpts.tabFocusMode),
enableDragAndDrop: (this.enableDragAndDrop !== newOpts.enableDragAndDrop),
layoutInfo: (!this.layoutInfo.equals(newOpts.layoutInfo)),
fontInfo: (!this.fontInfo.equals(newOpts.fontInfo)),
viewInfo: this.viewInfo.createChangeEvent(newOpts.viewInfo),
......@@ -1160,6 +1170,7 @@ export interface IConfigurationChangedEvent {
readonly autoClosingBrackets: boolean;
readonly useTabStops: boolean;
readonly tabFocusMode: boolean;
readonly enableDragAndDrop: boolean;
readonly layoutInfo: boolean;
readonly fontInfo: boolean;
readonly viewInfo: IViewConfigurationChangedEvent;
......
......@@ -1340,6 +1340,11 @@ declare module monaco.editor {
* Defaults to false.
*/
formatOnPaste?: boolean;
/**
* Controls if the editor should allow to move selections via drag and drop.
* Defaults to false.
*/
enableDragAndDrop?: boolean;
/**
* Enable the suggestion box to pop-up on trigger characters.
* Defaults to true.
......@@ -1599,6 +1604,7 @@ declare module monaco.editor {
readonly autoClosingBrackets: boolean;
readonly useTabStops: boolean;
readonly tabFocusMode: boolean;
readonly enableDragAndDrop: boolean;
readonly layoutInfo: EditorLayoutInfo;
readonly fontInfo: FontInfo;
readonly viewInfo: InternalEditorViewOptions;
......@@ -1616,6 +1622,7 @@ declare module monaco.editor {
readonly autoClosingBrackets: boolean;
readonly useTabStops: boolean;
readonly tabFocusMode: boolean;
readonly enableDragAndDrop: boolean;
readonly layoutInfo: boolean;
readonly fontInfo: boolean;
readonly viewInfo: IViewConfigurationChangedEvent;
......
......@@ -213,6 +213,7 @@ const configurationValueWhitelist = [
'editor.formatOnType',
'editor.formatOnSave',
'editor.formatOnPaste',
'editor.enableDragAndDrop',
'window.openFilesInNewWindow',
'javascript.validate.enable',
'editor.mouseWheelZoom',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册