Commit 08d24f68 authored by Яков's avatar Яков
Browse files

верстка

parent 07c74710
{ {
"name": "react-ag-qeditor", "name": "react-ag-qeditor",
"version": "1.1.46", "version": "1.1.47",
"description": "WYSIWYG html editor", "description": "WYSIWYG html editor",
"author": "atma", "author": "atma",
"license": "MIT", "license": "MIT",
......
...@@ -51,10 +51,42 @@ import IframeModal from './modals/IframeModal' ...@@ -51,10 +51,42 @@ import IframeModal from './modals/IframeModal'
import IframeCustomModal from './modals/IframeCustomModal' import IframeCustomModal from './modals/IframeCustomModal'
import { isMobile } from 'react-device-detect' import { isMobile } from 'react-device-detect'
import { ExportPdf } from './extensions/ExportPdf' import { ExportPdf } from './extensions/ExportPdf'
import { mergeAttributes } from "@tiptap/core"; import { mergeAttributes, Extension } from "@tiptap/core";
import Upload from "rc-upload"; import Upload from "rc-upload";
import { NodeSelection } from 'prosemirror-state' import { NodeSelection } from 'prosemirror-state'
// Выход из code block по Enter на пустой последней строке
const ExitCodeBlock = Extension.create({
name: 'exitCodeBlock',
addKeyboardShortcuts() {
return {
Enter: ({ editor }) => {
if (!editor.isActive('codeBlock')) return false
const { $anchor } = editor.state.selection
if (!editor.state.selection.empty) return false
const nodeText = $anchor.parent.textContent
const offset = $anchor.parentOffset
// Если курсор на последней строке и она пустая — выходим из блока
const lastNewline = nodeText.lastIndexOf('\n', offset - 1)
const currentLine = nodeText.slice(lastNewline + 1, offset)
if (currentLine === '') {
// Удаляем пустую строку и создаём параграф после блока
return editor
.chain()
.command(({ tr, state }) => {
const from = $anchor.pos - 1
tr.delete(from, $anchor.pos)
return true
})
.exitCode()
.run()
}
return false
}
}
}
})
// const CustomImage = Image.extend({ // const CustomImage = Image.extend({
// options: {inline: true}, // options: {inline: true},
// // addNodeView() { // // addNodeView() {
...@@ -673,6 +705,7 @@ const QEditor = ({ ...@@ -673,6 +705,7 @@ const QEditor = ({
const editor = useEditor({ const editor = useEditor({
extensions: [ extensions: [
StarterKit, StarterKit,
ExitCodeBlock,
Underline, Underline,
ImageResize, ImageResize,
Link.configure({ Link.configure({
...@@ -855,7 +888,7 @@ const QEditor = ({ ...@@ -855,7 +888,7 @@ const QEditor = ({
if (!uploadOptions.suggestUrl || !SUGGEST_TYPES.includes(innerModalType)) { if (!uploadOptions.suggestUrl || !SUGGEST_TYPES.includes(innerModalType)) {
return null return null
} }
if (suggestedLoading) { if (suggestedLoading && suggestedFiles.length === 0) {
return <div className='atma-editor-suggest-loading'>Загрузка файлов...</div> return <div className='atma-editor-suggest-loading'>Загрузка файлов...</div>
} }
if (!suggestedLoading && suggestedFiles.length === 0) { if (!suggestedLoading && suggestedFiles.length === 0) {
...@@ -934,16 +967,16 @@ const QEditor = ({ ...@@ -934,16 +967,16 @@ const QEditor = ({
<button <button
type='button' type='button'
className='atma-editor-suggest-page-btn' className='atma-editor-suggest-page-btn'
disabled={suggestPage <= 1} disabled={suggestPage <= 1 || suggestedLoading}
onClick={() => setSuggestPage(p => p - 1)} onClick={() => setSuggestPage(p => p - 1)}
>&#8592;</button> >&#8592;</button>
<span className='atma-editor-suggest-page-info'> <span className='atma-editor-suggest-page-info'>
{suggestPage} / {totalPages} {suggestedLoading ? '...' : `${suggestPage} / ${totalPages}`}
</span> </span>
<button <button
type='button' type='button'
className='atma-editor-suggest-page-btn' className='atma-editor-suggest-page-btn'
disabled={suggestPage >= totalPages} disabled={suggestPage >= totalPages || suggestedLoading}
onClick={() => setSuggestPage(p => p + 1)} onClick={() => setSuggestPage(p => p + 1)}
>&#8594;</button> >&#8594;</button>
</div> </div>
...@@ -1524,6 +1557,7 @@ const QEditor = ({ ...@@ -1524,6 +1557,7 @@ const QEditor = ({
align: 'center', align: 'center',
'data-node-id': `img-${Date.now()}-${Math.random().toString(36).slice(2, 10)}` 'data-node-id': `img-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`
}) })
.createParagraphNear()
.run() .run()
} }
}) })
......
...@@ -16,7 +16,7 @@ const toolsInit = { ...@@ -16,7 +16,7 @@ const toolsInit = {
{ type: 's', toggle: true, items: ['alignLeft', 'alignCenter', 'alignRight'] }, { type: 's', toggle: true, items: ['alignLeft', 'alignCenter', 'alignRight'] },
// strike // strike
{ type: 'g', items: ['strike'] }, // { type: 'g', items: ['strike'] },
// Table▼ // Table▼
{ {
......
...@@ -121,17 +121,19 @@ body{ ...@@ -121,17 +121,19 @@ body{
justify-content: center; justify-content: center;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
width: 100%;
&-video { &-video {
width: 50vw; width: 100%;
height: 50vh; height: auto;
border-radius: 12px;
} }
&-start-border { &-start-border {
border: 3px solid white; border: 3px solid white;
border-radius: 100px; border-radius: 100px;
position: absolute; position: absolute;
bottom: 210px; bottom: 24px;
height: 70px; height: 70px;
width: 70px; width: 70px;
padding: 5px; padding: 5px;
...@@ -144,13 +146,14 @@ body{ ...@@ -144,13 +146,14 @@ body{
&-timer { &-timer {
position: absolute; position: absolute;
top: 120px; top: 12px;
left: 50%;
transform: translateX(-50%);
font-weight: 400; font-weight: 400;
font-size: 21px; font-size: 21px;
line-height: 20px; line-height: 20px;
text-align: center; text-align: center;
color: #ffffff; color: #ffffff;
margin-top: 30px;
z-index: 2; z-index: 2;
} }
...@@ -175,13 +178,15 @@ body{ ...@@ -175,13 +178,15 @@ body{
} }
&-content { &-content {
width: 50vw; width: 100%;
height: 55vh; aspect-ratio: 16 / 9;
background-color: black; background-color: black;
border-radius: 12px; border-radius: 12px;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
overflow: hidden;
position: relative;
} }
} }
...@@ -257,7 +262,7 @@ body{ ...@@ -257,7 +262,7 @@ body{
box-shadow: 0 -3px 0 3px #ffffff; box-shadow: 0 -3px 0 3px #ffffff;
padding: 6px; padding: 6px;
z-index: 10; z-index: 10;
grid-gap: 7.5px; grid-gap: 8.7px;
&-g{ &-g{
display: flex; display: flex;
...@@ -438,6 +443,10 @@ body{ ...@@ -438,6 +443,10 @@ body{
max-width: 100%; max-width: 100%;
} }
img {
image-orientation: from-image;
}
blockquote{ blockquote{
border-left: 2px solid #ccc; border-left: 2px solid #ccc;
margin-left: 0; margin-left: 0;
...@@ -610,11 +619,12 @@ body{ ...@@ -610,11 +619,12 @@ body{
background: #fff; background: #fff;
transform: translate(0, -50%); transform: translate(0, -50%);
border-radius: 8px; border-radius: 8px;
//max-width: 90%;
max-width: 646px; max-width: 646px;
min-width: 540px;
padding: 48px; padding: 48px;
max-height: 900px; max-height: min(90dvh, 900px);
overflow-y: scroll; overflow-y: auto;
overflow-x: hidden;
@media (max-width: 600px) { @media (max-width: 600px) {
min-width: 0; min-width: 0;
...@@ -862,6 +872,9 @@ body{ ...@@ -862,6 +872,9 @@ body{
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap: 10px; gap: 10px;
max-height: 280px;
overflow-y: auto;
padding-right: 4px;
} }
&-item{ &-item{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment