@jvs-milkdown/crepe 1.2.8 → 1.2.9

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/cjs/index.js CHANGED
@@ -9003,6 +9003,23 @@ const DocumentHeader = vue.defineComponent({
9003
9003
  title.value = e.target.value;
9004
9004
  adjustTitleHeight();
9005
9005
  },
9006
+ onKeydown: (e) => {
9007
+ if (e.key !== "Enter") return;
9008
+ e.preventDefault();
9009
+ if (e.ctrlKey || e.metaKey) {
9010
+ const target = e.target;
9011
+ const start = target.selectionStart;
9012
+ const end = target.selectionEnd;
9013
+ title.value = title.value.slice(0, start) + "\n" + title.value.slice(end);
9014
+ requestAnimationFrame(() => {
9015
+ target.selectionStart = target.selectionEnd = start + 1;
9016
+ adjustTitleHeight();
9017
+ });
9018
+ } else {
9019
+ const view = props.ctx.get(core.editorViewCtx);
9020
+ view == null ? void 0 : view.focus();
9021
+ }
9022
+ },
9006
9023
  rows: 1,
9007
9024
  style: {
9008
9025
  width: "100%",