milkdown wip

This commit is contained in:
ivan 2024-02-28 16:03:32 +01:00
parent 930eaae8b5
commit 37b799cc02
3 changed files with 10 additions and 46 deletions

View file

@ -4,7 +4,7 @@ This file was generated by the Surface compiler.
import { defaultValueCtx, editorViewOptionsCtx, Editor, editorViewCtx, commandsCtx, rootCtx } from '@milkdown/core';
import { $prose, replaceAll, insert} from '@milkdown/utils';
import { commonmark, wrapInHeadingCommand, toggleStrongCommand, toggleEmphasisCommand} from '@milkdown/preset-commonmark';
import { commonmark, wrapInHeadingCommand, toggleStrongCommand, toggleEmphasisCommand, remarkInlineLinkPlugin } from '@milkdown/preset-commonmark';
import {gfm} from "@milkdown/preset-gfm";
import { emoji } from '@milkdown/plugin-emoji';
import { listener, listenerCtx } from '@milkdown/plugin-listener';
@ -348,7 +348,8 @@ const createEditor = async (_this, hidden_input, composer$) => {
})
// .config(nord)
.use(commonmark)
// .use(gfm)
.use(remarkInlineLinkPlugin)
.use(gfm)
.use(emoji)
.use(listener)
.use(mentionSlash)
@ -484,26 +485,9 @@ const createEditor = async (_this, hidden_input, composer$) => {
// })
composer$.addEventListener('focus', (e) => {
console.log("QUII")
if (e.target.matches('div[contenteditable]')) {
document.body.classList.add('no-scroll');
}
})
composer$.addEventListener('blur', (e) => {
console.log("QUII")
if (e.target.matches('div[contenteditable]')) {
document.body.classList.remove('no-scroll');
}
})
composer$.addEventListener('click', (e) => {
if (e.target.matches('div[contenteditable]')) {
document.body.classList.add('no-scroll');
}
if (e.target.matches('.emoji_btn')) {
e.preventDefault();
const emoji = e.target.dataset.emoji;
@ -550,27 +534,7 @@ export default {
mounted() {
const hidden_input = document.getElementById('editor_hidden_input');
const composer$ = this.el.querySelector('#editor')
// when composer$ get focus prevent the body from scrolling
// if (window.innerWidth <= 768) {
// document.body.classList.add('no-scroll');
// }
createEditor(this, hidden_input, composer$)
// editor.addEventListener('click', function() {
// console.log("FOCUSSSS")
// document.body.classList.add('no-scroll');
// });
},
updated() {
// composer$.addEventListener('click', function() {
// console.log("FOCUSSSS")
// document.body.classList.add('no-scroll');
// });
// if (window.innerWidth <= 768) {
// document.body.classList.add('no-scroll');
// } else {
// document.body.classList.remove('no-scroll');
// }
createEditor(this, hidden_input, composer$)
}
}

View file

@ -86,7 +86,7 @@ let PreviewActivity = {
console.log(trigger)
console.log(window.liveSocket)
console.log(anchor)
console.log(anchor.classList)
// console.log(anchor.classList)
console.log(e.ctrlKey)
console.log(e.metaKey)
console.log(window.getSelection().toString())

View file

@ -20,7 +20,7 @@
"blurhash": {:hex, :rinpatch_blurhash, "0.1.0", "01a888b0f5f1f382ab52e4396f01831cbe8486ea5828604c90f4dac533d39a4b", [:mix], [{:mogrify, "~> 0.8.0", [hex: :mogrify, repo: "hexpm", optional: true]}], "hexpm", "19911a5dcbb0acb9710169a72f702bce6cb048822b12de566ccd82b2cc42b907"},
"bolt_sips": {:hex, :bolt_sips, "2.0.11", "a1cb78d8db4aba750f6771a9fd4a10b3300618b7b0433b12105c64d21d27b4ba", [:mix], [{:calendar, "~> 0.17.2", [hex: :calendar, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.4", [hex: :db_connection, repo: "hexpm", optional: false]}, {:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: false]}, {:poison, "~> 3.1", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm", "227a6669e14fa6d331738857b32b5cd022b4c13808e947ccfec8eccb8fedb0e5"},
"bonfire": {:git, "https://github.com/bonfire-networks/bonfire_spark", "f38cf5c1abbb80dee990024eced8b6ebd9a1aaee", [branch: "main"]},
"bonfire_boundaries": {:git, "https://github.com/bonfire-networks/bonfire_boundaries", "d400ccd44f1c63f0b02eec705762ecb7fcf6c51d", [branch: "main"]},
"bonfire_boundaries": {:git, "https://github.com/bonfire-networks/bonfire_boundaries", "c844f9fa0fc8e577cd2161f058effa7e405d6808", [branch: "main"]},
"bonfire_classify": {:git, "https://github.com/bonfire-networks/bonfire_classify", "993a4eee0cbcc4e34be5cbae92123b77c11e8bb2", [branch: "main"]},
"bonfire_common": {:git, "https://github.com/bonfire-networks/bonfire_common", "2dd7e90ad37f1aeca8b14ecfa9e8d238649e191e", [branch: "main"]},
"bonfire_data_access_control": {:git, "https://github.com/bonfire-networks/bonfire_data_access_control", "b7c3cd9886a22e0b3652baa7edd079fac29bdea3", [branch: "main"]},
@ -39,7 +39,7 @@
"bonfire_invite_links": {:git, "https://github.com/bonfire-networks/bonfire_invite_links", "1a1803a13d5487e6e10c3cd03df523a10af48d79", [branch: "main"]},
"bonfire_label": {:git, "https://github.com/bonfire-networks/bonfire_label", "cdbc0c0eda41ae14e32937e25669dc54991cf7eb", [branch: "main"]},
"bonfire_mailer": {:git, "https://github.com/bonfire-networks/bonfire_mailer", "001ca742f2bcc234c2d84500d0de3d70a9ad44e8", [branch: "main"]},
"bonfire_me": {:git, "https://github.com/bonfire-networks/bonfire_me", "2154b026b3dc564b475c18590567a8c6afba9a00", [branch: "main"]},
"bonfire_me": {:git, "https://github.com/bonfire-networks/bonfire_me", "b6c5c2c7bc3bb405072672c8887c59867d2fa329", [branch: "main"]},
"bonfire_messages": {:git, "https://github.com/bonfire-networks/bonfire_messages", "669586ca419abbaf5046c8de12a78ee0da5f7c85", []},
"bonfire_open_id": {:git, "https://github.com/bonfire-networks/bonfire_open_id", "d4677da6303ddd6d45231c97f5de78926b2f5711", [branch: "main"]},
"bonfire_open_science": {:git, "https://github.com/bonfire-networks/bonfire_open_science", "636d5ec356732751027826f705bf57b2b7ca3ddb", [branch: "main"]},
@ -48,8 +48,8 @@
"bonfire_social": {:git, "https://github.com/bonfire-networks/bonfire_social", "ca4775f97c452d6e3e0a2c021baeaa9259f78627", [branch: "main"]},
"bonfire_social_graph": {:git, "https://github.com/bonfire-networks/bonfire_social_graph", "69562a94a36978e9febd174c0bd013f12fa290ed", []},
"bonfire_tag": {:git, "https://github.com/bonfire-networks/bonfire_tag", "0048891aaa464c74546d34703798f0685ac89861", [branch: "main"]},
"bonfire_ui_common": {:git, "https://github.com/bonfire-networks/bonfire_ui_common", "d0b3f33b7838fae88de0874240dccc08aea74bc2", [branch: "main"]},
"bonfire_ui_me": {:git, "https://github.com/bonfire-networks/bonfire_ui_me", "0d804b0ad55a6a0c6f3282bbcca405c07dd69731", [branch: "main"]},
"bonfire_ui_common": {:git, "https://github.com/bonfire-networks/bonfire_ui_common", "b2152c5650a5b99a890b7d3d9b678c8b52ec8021", [branch: "main"]},
"bonfire_ui_me": {:git, "https://github.com/bonfire-networks/bonfire_ui_me", "a9d0e9e8038410b407f46350d038866d6fd685d0", [branch: "main"]},
"bonfire_ui_messages": {:git, "https://github.com/bonfire-networks/bonfire_ui_messages", "0e79478c9a87545338bc9cc20ee7a17b9bcd6444", []},
"bonfire_ui_moderation": {:git, "https://github.com/bonfire-networks/bonfire_ui_moderation", "f945aa4a281013c7454155b6d7ab942b7a68da0f", []},
"bonfire_ui_posts": {:git, "https://github.com/bonfire-networks/bonfire_ui_posts", "8421c1302f6ca6422e812191d4d559f62d11b832", []},