Commit 08dc066a by yakoff94

add close button on video

parent fb9086ec
...@@ -6,9 +6,7 @@ import 'react-ag-qeditor/dist/index.css' ...@@ -6,9 +6,7 @@ import 'react-ag-qeditor/dist/index.css'
const App = () => { const App = () => {
return <div style={{padding:40}}> return <div style={{padding:40}}>
<QEditor <QEditor
value={` value={`<iframe src="https://www.youtube.com/embed/YmZGP7YP8c4" frameborder="0" allowfullscreen="true"></iframe><video src="https://cdn.atmaguru.online/2/demo/V/k/VkrEXjkxnutXLgcJPt5CLXNgEj4RaL9Zk4SQhIMUjOeIRpu0dSKtQCIMl49pJM6N.webm" controls="true"></video><p>Так исторически сложилось, что взрослым людям стараются дать максимум материалов: часовые лекции, объемные массивы текста и должностных инструкций. Сотрудник изучает огромный объем информации. Пытается его запомнить, а потом в конце курса сдать большой аттестационный экзамен. Вы не учитывете при этом, что мозг взрослого человека перегружен, ему нужно выполнять обязанности по работе, думать о домашних делах, его постоянно отвлекают менеджеры и коллеги по работе… Единственный правильный способ — это давать информацию небольшими кусочками и после каждой порции проверять усвоена она или нет.</p><p></p><p>что-то новое о компании<br><a href="https://cdn.atmaguru.online/1/demo/T/G/TGvSAoLawONkteJ47yyNfmsC8zNe3ZRG4iO0ZfAjmvOIZkm20BWp8KdWCH5p1Rrx.gif" target="_blank" download="Редактор.gif" data-size="37 Мб">РСкачать книгу</a> <br></p>`}
<p>There are two images below. One with alt text, and one without.</p><p></p><p></p><p style="text-align: center"><img src="https://cdn.atmaguru.online/2/atmacompany/L/u/Luzfq2rOeEruKLfLGNDDCWJcjh0y2zYimU7semFd3ZgW7uxA14DGwPf9jP5pH0yQ.png" width="461"></p><p></p><p></p><p>ромывроапывроаыв</p><p></p>
`}
onChange={(value)=>{ onChange={(value)=>{
console.log(value); console.log(value);
}} }}
......
...@@ -35,6 +35,8 @@ const Video = Node.create({ ...@@ -35,6 +35,8 @@ const Video = Node.create({
addNodeView() { addNodeView() {
return ({ editor, node }) => { return ({ editor, node }) => {
const container = document.createElement('div');
const video = document.createElement('video'); const video = document.createElement('video');
if (editor.isEditable) { if (editor.isEditable) {
video.className = 'pointer-events-none'; video.className = 'pointer-events-none';
...@@ -42,8 +44,17 @@ const Video = Node.create({ ...@@ -42,8 +44,17 @@ const Video = Node.create({
video.src = node.attrs.src; video.src = node.attrs.src;
video.poster = node.attrs.poster; video.poster = node.attrs.poster;
video.controls = true; video.controls = true;
const closeBtn = document.createElement('button')
closeBtn.textContent = 'X'
closeBtn.classList.add('closeBtn')
closeBtn.addEventListener('click', function () {
container.remove()
})
container.append(closeBtn, video)
return { return {
dom: video, dom: container,
} }
} }
}, },
......
...@@ -1066,6 +1066,7 @@ body{ ...@@ -1066,6 +1066,7 @@ body{
top: 10px; top: 10px;
cursor: pointer; cursor: pointer;
right: 8px; right: 8px;
z-index: 9;
} }
.customIframe { .customIframe {
......
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