mirror of
https://github.com/open-webui/open-webui
synced 2025-02-20 12:00:22 +00:00
refac
This commit is contained in:
parent
8330fcdb5c
commit
54b843c367
@ -2295,7 +2295,7 @@
|
|||||||
if (e.detail) {
|
if (e.detail) {
|
||||||
prompt = '';
|
prompt = '';
|
||||||
await tick();
|
await tick();
|
||||||
submitPrompt(e.detail);
|
submitPrompt(e.detail.replaceAll('\n\n', '\n'));
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
@ -24,8 +24,6 @@
|
|||||||
import { baseKeymap, chainCommands } from 'prosemirror-commands';
|
import { baseKeymap, chainCommands } from 'prosemirror-commands';
|
||||||
import { DOMParser, DOMSerializer, Schema, Fragment } from 'prosemirror-model';
|
import { DOMParser, DOMSerializer, Schema, Fragment } from 'prosemirror-model';
|
||||||
|
|
||||||
import { dev } from '$app/environment';
|
|
||||||
|
|
||||||
export let className = 'input-prose';
|
export let className = 'input-prose';
|
||||||
export let shiftEnter = false;
|
export let shiftEnter = false;
|
||||||
|
|
||||||
@ -186,8 +184,6 @@
|
|||||||
const hasBold = storedMarks.some((mark) => mark.type === state.schema.marks.strong);
|
const hasBold = storedMarks.some((mark) => mark.type === state.schema.marks.strong);
|
||||||
const hasItalic = storedMarks.some((mark) => mark.type === state.schema.marks.em);
|
const hasItalic = storedMarks.some((mark) => mark.type === state.schema.marks.em);
|
||||||
|
|
||||||
console.log('Stored marks after space:', storedMarks, hasBold, hasItalic);
|
|
||||||
|
|
||||||
// Remove marks from the space character (marks applied to the space character will be marked as false)
|
// Remove marks from the space character (marks applied to the space character will be marked as false)
|
||||||
if (hasBold) {
|
if (hasBold) {
|
||||||
tr = tr.removeMark(from - 1, from, state.schema.marks.strong);
|
tr = tr.removeMark(from - 1, from, state.schema.marks.strong);
|
||||||
@ -356,7 +352,6 @@
|
|||||||
// Prevent default tab navigation and provide indent/outdent behavior inside lists:
|
// Prevent default tab navigation and provide indent/outdent behavior inside lists:
|
||||||
Tab: chainCommands((state, dispatch, view) => {
|
Tab: chainCommands((state, dispatch, view) => {
|
||||||
const { $from } = state.selection;
|
const { $from } = state.selection;
|
||||||
console.log('Tab key pressed', $from.parent, $from.parent.type);
|
|
||||||
if (isInList(state)) {
|
if (isInList(state)) {
|
||||||
return sinkListItem(schema.nodes.list_item)(state, dispatch);
|
return sinkListItem(schema.nodes.list_item)(state, dispatch);
|
||||||
} else {
|
} else {
|
||||||
@ -366,7 +361,6 @@
|
|||||||
}),
|
}),
|
||||||
'Shift-Tab': (state, dispatch, view) => {
|
'Shift-Tab': (state, dispatch, view) => {
|
||||||
const { $from } = state.selection;
|
const { $from } = state.selection;
|
||||||
console.log('Shift-Tab key pressed', $from.parent, $from.parent.type);
|
|
||||||
if (isInList(state)) {
|
if (isInList(state)) {
|
||||||
return liftListItem(schema.nodes.list_item)(state, dispatch);
|
return liftListItem(schema.nodes.list_item)(state, dispatch);
|
||||||
}
|
}
|
||||||
@ -386,10 +380,6 @@
|
|||||||
view.updateState(newState);
|
view.updateState(newState);
|
||||||
|
|
||||||
value = serializeEditorContent(newState.doc); // Convert ProseMirror content to markdown text
|
value = serializeEditorContent(newState.doc); // Convert ProseMirror content to markdown text
|
||||||
|
|
||||||
if (dev) {
|
|
||||||
console.log(value);
|
|
||||||
}
|
|
||||||
eventDispatch('input', { value });
|
eventDispatch('input', { value });
|
||||||
},
|
},
|
||||||
handleDOMEvents: {
|
handleDOMEvents: {
|
||||||
@ -406,7 +396,6 @@
|
|||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
paste: (view, event) => {
|
paste: (view, event) => {
|
||||||
console.log(event);
|
|
||||||
if (event.clipboardData) {
|
if (event.clipboardData) {
|
||||||
// Check if the pasted content contains image files
|
// Check if the pasted content contains image files
|
||||||
const hasImageFile = Array.from(event.clipboardData.files).some((file) =>
|
const hasImageFile = Array.from(event.clipboardData.files).some((file) =>
|
||||||
@ -417,9 +406,6 @@
|
|||||||
const hasImageItem = Array.from(event.clipboardData.items).some((item) =>
|
const hasImageItem = Array.from(event.clipboardData.items).some((item) =>
|
||||||
item.type.startsWith('image/')
|
item.type.startsWith('image/')
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log('Has image file:', hasImageFile, 'Has image item:', hasImageItem);
|
|
||||||
|
|
||||||
if (hasImageFile) {
|
if (hasImageFile) {
|
||||||
// If there's an image, dispatch the event to the parent
|
// If there's an image, dispatch the event to the parent
|
||||||
eventDispatch('paste', { event });
|
eventDispatch('paste', { event });
|
||||||
@ -440,7 +426,6 @@
|
|||||||
},
|
},
|
||||||
// Handle space input after browser has completed it
|
// Handle space input after browser has completed it
|
||||||
keyup: (view, event) => {
|
keyup: (view, event) => {
|
||||||
console.log('Keyup event:', event);
|
|
||||||
if (event.key === ' ' && event.code === 'Space') {
|
if (event.key === ' ' && event.code === 'Space') {
|
||||||
afterSpacePress(view.state, view.dispatch);
|
afterSpacePress(view.state, view.dispatch);
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,11 @@
|
|||||||
dispatch('input');
|
dispatch('input');
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div class="dark:text-gray-300 text-gray-700 font-medium">{tag.name}</div>
|
<div
|
||||||
|
class="dark:text-gray-300 text-gray-700 font-medium line-clamp-1 flex-shrink-0"
|
||||||
|
>
|
||||||
|
{tag.name}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class=" text-gray-500 line-clamp-1">
|
<div class=" text-gray-500 line-clamp-1">
|
||||||
{tag.id}
|
{tag.id}
|
||||||
|
Loading…
Reference in New Issue
Block a user