@jvs-milkdown/crepe 1.2.8 → 1.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/esm/index.js CHANGED
@@ -9001,6 +9001,23 @@ const DocumentHeader = defineComponent({
9001
9001
  title.value = e.target.value;
9002
9002
  adjustTitleHeight();
9003
9003
  },
9004
+ onKeydown: (e) => {
9005
+ if (e.key !== "Enter") return;
9006
+ e.preventDefault();
9007
+ if (e.ctrlKey || e.metaKey) {
9008
+ const target = e.target;
9009
+ const start = target.selectionStart;
9010
+ const end = target.selectionEnd;
9011
+ title.value = title.value.slice(0, start) + "\n" + title.value.slice(end);
9012
+ requestAnimationFrame(() => {
9013
+ target.selectionStart = target.selectionEnd = start + 1;
9014
+ adjustTitleHeight();
9015
+ });
9016
+ } else {
9017
+ const view = props.ctx.get(editorViewCtx);
9018
+ view == null ? void 0 : view.focus();
9019
+ }
9020
+ },
9004
9021
  rows: 1,
9005
9022
  style: {
9006
9023
  width: "100%",