@remirror/extension-hard-break
Advanced tools
Comparing version 1.0.0-next.13 to 1.0.0-next.15
# @remirror/extension-hard-break | ||
## 1.0.0-next.15 | ||
> 2020-07-31 | ||
### Minor Changes | ||
- 08e51078: Add `insertHardBreak` command. | ||
Add inline documentation instructing developers to use the `TrailingNodeExtension` when using | ||
`hardBreak` to exit a `codeBlock`. | ||
### Patch Changes | ||
- Updated dependencies [cdc5b801] | ||
- Updated dependencies [44516da4] | ||
- Updated dependencies [e5ea0c84] | ||
- Updated dependencies [a404f5a1] | ||
- Updated dependencies [6c3b278b] | ||
- @remirror/core@1.0.0-next.15 | ||
## 1.0.0-next.13 | ||
@@ -4,0 +24,0 @@ |
@@ -1,2 +0,13 @@ | ||
import { ApplySchemaAttributes, KeyBindings, NodeExtension, NodeExtensionSpec } from '@remirror/core'; | ||
import { ApplySchemaAttributes, CommandFunction, KeyBindings, NodeExtension, NodeExtensionSpec } from '@remirror/core'; | ||
/** | ||
* An extension which provides the functionality for inserting a `hardBreak` | ||
* `<br />` tag into the editor. | ||
* | ||
* @remarks | ||
* | ||
* It will automatically exit when used inside a `codeClock`. To | ||
* prevent problems occurring when the codeblock is the last node in the | ||
* doc, you should add the `TrailingNodeExtension` which automatically appends a | ||
* paragraph node to the last node.. | ||
*/ | ||
export declare class HardBreakExtension extends NodeExtension { | ||
@@ -6,2 +17,8 @@ get name(): "hardBreak"; | ||
createKeymap(): KeyBindings; | ||
createCommands(): { | ||
/** | ||
* Inserts a hardBreak `<br />` tag into the editor. | ||
*/ | ||
insertHardBreak: () => CommandFunction; | ||
}; | ||
} |
@@ -9,2 +9,14 @@ 'use strict'; | ||
var _dec, _class; | ||
/** | ||
* An extension which provides the functionality for inserting a `hardBreak` | ||
* `<br />` tag into the editor. | ||
* | ||
* @remarks | ||
* | ||
* It will automatically exit when used inside a `codeClock`. To | ||
* prevent problems occurring when the codeblock is the last node in the | ||
* doc, you should add the `TrailingNodeExtension` which automatically appends a | ||
* paragraph node to the last node.. | ||
*/ | ||
var HardBreakExtension = (_dec = /*#__PURE__*/core.extensionDecorator({}), /*#__PURE__*/_dec(_class = class HardBreakExtension extends core.NodeExtension { | ||
@@ -30,10 +42,4 @@ get name() { | ||
createKeymap() { | ||
var command = core.chainCommands(core.convertCommand(commands.exitCode), (_ref) => { | ||
var state = _ref.state, | ||
dispatch = _ref.dispatch; | ||
if (dispatch) { | ||
dispatch(state.tr.replaceSelectionWith(this.type.create()).scrollIntoView()); | ||
} | ||
var command = core.chainCommands(core.convertCommand(commands.exitCode), () => { | ||
this.store.getCommands().insertHardBreak(); | ||
return true; | ||
@@ -47,4 +53,19 @@ }); | ||
createCommands() { | ||
return { | ||
/** | ||
* Inserts a hardBreak `<br />` tag into the editor. | ||
*/ | ||
insertHardBreak: () => parameter => { | ||
var tr = parameter.tr, | ||
dispatch = parameter.dispatch; // Create the `hardBreak` | ||
dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr.replaceSelectionWith(this.type.create()).scrollIntoView()); | ||
return true; | ||
} | ||
}; | ||
} | ||
}) || _class); | ||
exports.HardBreakExtension = HardBreakExtension; |
@@ -25,7 +25,4 @@ "use strict"; | ||
createKeymap() { | ||
var command = core.chainCommands(core.convertCommand(commands.exitCode), _ref => { | ||
var state = _ref.state, dispatch = _ref.dispatch; | ||
return dispatch && dispatch(state.tr.replaceSelectionWith(this.type.create()).scrollIntoView()), | ||
!0; | ||
}); | ||
var command = core.chainCommands(core.convertCommand(commands.exitCode), () => (this.store.getCommands().insertHardBreak(), | ||
!0)); | ||
return { | ||
@@ -36,4 +33,13 @@ "Mod-Enter": command, | ||
} | ||
createCommands() { | ||
return { | ||
insertHardBreak: () => parameter => { | ||
var tr = parameter.tr, dispatch = parameter.dispatch; | ||
return null == dispatch || dispatch(tr.replaceSelectionWith(this.type.create()).scrollIntoView()), | ||
!0; | ||
} | ||
}; | ||
} | ||
}) || _class; | ||
exports.HardBreakExtension = HardBreakExtension; |
@@ -5,2 +5,14 @@ import { NodeExtension, chainCommands, convertCommand, extensionDecorator } from '@remirror/core'; | ||
var _dec, _class; | ||
/** | ||
* An extension which provides the functionality for inserting a `hardBreak` | ||
* `<br />` tag into the editor. | ||
* | ||
* @remarks | ||
* | ||
* It will automatically exit when used inside a `codeClock`. To | ||
* prevent problems occurring when the codeblock is the last node in the | ||
* doc, you should add the `TrailingNodeExtension` which automatically appends a | ||
* paragraph node to the last node.. | ||
*/ | ||
var HardBreakExtension = (_dec = /*#__PURE__*/extensionDecorator({}), /*#__PURE__*/_dec(_class = class HardBreakExtension extends NodeExtension { | ||
@@ -26,10 +38,4 @@ get name() { | ||
createKeymap() { | ||
var command = chainCommands(convertCommand(exitCode), (_ref) => { | ||
var state = _ref.state, | ||
dispatch = _ref.dispatch; | ||
if (dispatch) { | ||
dispatch(state.tr.replaceSelectionWith(this.type.create()).scrollIntoView()); | ||
} | ||
var command = chainCommands(convertCommand(exitCode), () => { | ||
this.store.getCommands().insertHardBreak(); | ||
return true; | ||
@@ -43,4 +49,19 @@ }); | ||
createCommands() { | ||
return { | ||
/** | ||
* Inserts a hardBreak `<br />` tag into the editor. | ||
*/ | ||
insertHardBreak: () => parameter => { | ||
var tr = parameter.tr, | ||
dispatch = parameter.dispatch; // Create the `hardBreak` | ||
dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr.replaceSelectionWith(this.type.create()).scrollIntoView()); | ||
return true; | ||
} | ||
}; | ||
} | ||
}) || _class); | ||
export { HardBreakExtension }; |
{ | ||
"name": "@remirror/extension-hard-break", | ||
"version": "1.0.0-next.13", | ||
"version": "1.0.0-next.15", | ||
"description": "Add `br` tags to your editor.", | ||
@@ -26,7 +26,7 @@ "keywords": [ | ||
"devDependencies": { | ||
"@remirror/core": "^1.0.0-next.13", | ||
"@remirror/core": "^1.0.0-next.15", | ||
"@remirror/pm": "^1.0.0-next.4" | ||
}, | ||
"peerDependencies": { | ||
"@remirror/core": "^1.0.0-next.13", | ||
"@remirror/core": "^1.0.0-next.15", | ||
"@remirror/pm": "^1.0.0-next.4" | ||
@@ -33,0 +33,0 @@ }, |
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
12201
185