@codemirror/commands
Advanced tools
Comparing version 0.19.3 to 0.19.4
@@ -0,1 +1,7 @@ | ||
## 0.19.4 (2021-09-13) | ||
### Bug fixes | ||
Make commands that affect the editor's content check `state.readOnly` and return false when that is true. | ||
## 0.19.3 (2021-09-09) | ||
@@ -2,0 +8,0 @@ |
@@ -419,2 +419,4 @@ import { EditorSelection, CharCategory } from '@codemirror/state'; | ||
function deleteBy({ state, dispatch }, by) { | ||
if (state.readOnly) | ||
return false; | ||
let event = "delete.selection"; | ||
@@ -528,2 +530,4 @@ let changes = state.changeByRange(range => { | ||
const deleteTrailingWhitespace = ({ state, dispatch }) => { | ||
if (state.readOnly) | ||
return false; | ||
let changes = []; | ||
@@ -555,2 +559,4 @@ for (let pos = 0, prev = "", iter = state.doc.iter();;) { | ||
const splitLine = ({ state, dispatch }) => { | ||
if (state.readOnly) | ||
return false; | ||
let changes = state.changeByRange(range => { | ||
@@ -567,2 +573,4 @@ return { changes: { from: range.from, to: range.to, insert: Text.of(["", ""]) }, | ||
const transposeChars = ({ state, dispatch }) => { | ||
if (state.readOnly) | ||
return false; | ||
let changes = state.changeByRange(range => { | ||
@@ -601,2 +609,4 @@ if (!range.empty || range.from == 0 || range.from == state.doc.length) | ||
function moveLine(state, dispatch, forward) { | ||
if (state.readOnly) | ||
return false; | ||
let changes = [], ranges = []; | ||
@@ -638,2 +648,4 @@ for (let block of selectedLineBlocks(state)) { | ||
function copyLine(state, dispatch, forward) { | ||
if (state.readOnly) | ||
return false; | ||
let changes = []; | ||
@@ -661,2 +673,4 @@ for (let block of selectedLineBlocks(state)) { | ||
const deleteLine = view => { | ||
if (view.state.readOnly) | ||
return false; | ||
let { state } = view, changes = state.changes(selectedLineBlocks(state).map(({ from, to }) => { | ||
@@ -699,2 +713,4 @@ if (from > 0) | ||
const insertNewlineAndIndent = ({ state, dispatch }) => { | ||
if (state.readOnly) | ||
return false; | ||
let changes = state.changeByRange(({ from, to }) => { | ||
@@ -745,2 +761,4 @@ let explode = from == to && isBetweenBrackets(state, from); | ||
const indentSelection = ({ state, dispatch }) => { | ||
if (state.readOnly) | ||
return false; | ||
let updated = Object.create(null); | ||
@@ -773,2 +791,4 @@ let context = new IndentContext(state, { overrideIndentation: start => { | ||
const indentMore = ({ state, dispatch }) => { | ||
if (state.readOnly) | ||
return false; | ||
dispatch(state.update(changeBySelectedLine(state, (line, changes) => { | ||
@@ -784,2 +804,4 @@ changes.push({ from: line.from, insert: state.facet(indentUnit) }); | ||
const indentLess = ({ state, dispatch }) => { | ||
if (state.readOnly) | ||
return false; | ||
dispatch(state.update(changeBySelectedLine(state, (line, changes) => { | ||
@@ -786,0 +808,0 @@ let space = /^\s*/.exec(line.text)[0]; |
{ | ||
"name": "@codemirror/commands", | ||
"version": "0.19.3", | ||
"version": "0.19.4", | ||
"description": "Collection of editing commands for the CodeMirror code editor", | ||
@@ -31,3 +31,3 @@ "scripts": { | ||
"@codemirror/matchbrackets": "^0.19.0", | ||
"@codemirror/state": "^0.19.0", | ||
"@codemirror/state": "^0.19.2", | ||
"@codemirror/text": "^0.19.0", | ||
@@ -34,0 +34,0 @@ "@codemirror/view": "^0.19.0", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
121105
2394
Updated@codemirror/state@^0.19.2