@ozdao/prometheus-framework 0.0.85 → 0.0.87
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-15e71ec4.js +1 -0
- package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-628f013e.mjs +138 -0
- package/dist/Breadcrumbs.vue_vue_type_style_index_0_lang-cdbafd07.mjs +1944 -0
- package/dist/ButtonFollow-728aab73.mjs +130 -0
- package/dist/CardHeader-ce5a1a75.mjs +96 -0
- package/dist/CardOrganization-58b54995.js +1 -0
- package/dist/CardOrganization-91e79698.mjs +320 -0
- package/dist/CardOrganization-ee5c34ab.js +1 -0
- package/dist/CardOrganization-f70bd169.mjs +202 -0
- package/dist/Comments-63f154a6.js +9 -0
- package/dist/Comments-c092550f.mjs +76 -0
- package/dist/Comments-c5afa4d6.mjs +459 -0
- package/dist/EditProductImages-61ff4321.mjs +236 -0
- package/dist/Feed-8fd41524.js +1 -0
- package/dist/Feed-926cf4f3.mjs +355 -0
- package/dist/Feed-a31c43c2.mjs +423 -0
- package/dist/Feed-ecf37814.mjs +367 -0
- package/dist/IconEdit-736c89be.js +1 -0
- package/dist/IconEdit-e9fd4c6c.mjs +21 -0
- package/dist/PlaceholderUserpic-995da0fc.mjs +28 -0
- package/dist/Popup-0c791801.mjs +76 -0
- package/dist/Popup-105ef2c3.js +1 -0
- package/dist/Popup-82fb2c8a.mjs +76 -0
- package/dist/Product-2f3d592f.mjs +837 -0
- package/dist/Product-2fbf9d99.js +7 -0
- package/dist/Product-6c37ef35.js +7 -0
- package/dist/Product-7087b358.mjs +837 -0
- package/dist/ProductEdit-20709821.mjs +349 -0
- package/dist/ProductEdit-a81d13b9.js +1 -0
- package/dist/ProductEdit-c5067942.mjs +113 -0
- package/dist/ProfileBlogposts-79d5c858.mjs +63 -0
- package/dist/ProfileBlogposts-eca9916c.js +1 -0
- package/dist/ProfileBlogposts-fb014bc6.mjs +63 -0
- package/dist/ProfileComments-48f3d4bc.mjs +43 -0
- package/dist/ProfileComments-58094a50.mjs +43 -0
- package/dist/ProfileComments-b919f021.js +1 -0
- package/dist/ProfileEvents-05485e20.js +1 -0
- package/dist/ProfileEvents-20695376.mjs +55 -0
- package/dist/ProfileEvents-5d206e3d.mjs +55 -0
- package/dist/ProfileLikes-2f3a4488.js +1 -0
- package/dist/ProfileLikes-503712ec.mjs +43 -0
- package/dist/ProfileLikes-b5ac7f48.mjs +43 -0
- package/dist/ProfileOrganizations-0b76e38f.js +1 -0
- package/dist/ProfileOrganizations-32ab1e30.mjs +211 -0
- package/dist/ProfileOrganizations-3f305f4e.mjs +210 -0
- package/dist/ProfileOrganizations-50fce34e.js +1 -0
- package/dist/Publics-3f277c17.js +1 -0
- package/dist/Publics-49dbeafc.js +1 -0
- package/dist/Publics-9ebffff1.mjs +122 -0
- package/dist/Publics-b0fad2b0.mjs +1926 -0
- package/dist/Tab-58cd105f.mjs +46 -0
- package/dist/Tab-6f0a4909.js +1 -0
- package/dist/UploadImage-441e8526.js +1 -0
- package/dist/UploadImage-d1dbc280.mjs +99 -0
- package/dist/UploadImage-ff8f9a0c.mjs +83 -0
- package/dist/auth-35ef1791.mjs +1502 -0
- package/dist/auth.client.cjs +2 -2
- package/dist/auth.client.js +61 -41
- package/dist/auth.validation-29113f37.mjs +20 -0
- package/dist/categories-d669f3af.mjs +225 -0
- package/dist/community.client.cjs +1 -9
- package/dist/community.client.js +369 -741
- package/dist/community.server.js +16 -4
- package/dist/community.server.mjs +16 -4
- package/dist/events.client.cjs +1 -1
- package/dist/events.client.js +433 -331
- package/dist/events.server.js +19 -2
- package/dist/events.server.mjs +19 -2
- package/dist/inputs.validation-24ae76b9.js +1 -0
- package/dist/modules/constructor/components/elements/Bullets.vue.d.ts +15 -0
- package/dist/modules/constructor/components/elements/Caption.vue.d.ts +15 -0
- package/dist/modules/constructor/components/elements/H2.vue.d.ts +16 -0
- package/dist/modules/constructor/components/elements/Image.vue.d.ts +8 -0
- package/dist/modules/constructor/components/elements/ImageUpload.vue.d.ts +9 -0
- package/dist/modules/constructor/components/elements/Textarea.vue.d.ts +12 -0
- package/dist/modules/constructor/components/sections/Constructor.vue.d.ts +7 -0
- package/dist/modules/events/components/sections/Feed.vue.d.ts +1 -0
- package/dist/modules/icons/entities/IconCommunity.vue.d.ts +2 -0
- package/dist/organizations-1b4c84ee.mjs +121 -0
- package/dist/organizations-af43bda4.js +1 -0
- package/dist/organizations.client-253c8068.mjs +3179 -0
- package/dist/organizations.client-c60d7659.js +3 -0
- package/dist/organizations.client.cjs +1 -3
- package/dist/organizations.client.js +50 -3026
- package/dist/organizations.server.js +1 -1
- package/dist/organizations.server.mjs +1 -1
- package/dist/style.css +1 -1
- package/dist/users.client.cjs +1 -1
- package/dist/users.client.js +245 -208
- package/package.json +1 -1
- package/src/modules/auth/router/auth.js +28 -7
- package/src/modules/community/community.client.js +1 -12
- package/src/modules/community/components/pages/BlogPost.vue +1 -1
- package/src/modules/community/components/pages/CreateBlogPost.vue +8 -151
- package/src/modules/community/middlewares/server/verifyBlogpost.js +24 -11
- package/src/modules/{community → constructor}/components/elements/Textarea.vue +3 -11
- package/src/modules/constructor/components/sections/Constructor.vue +167 -0
- package/src/modules/events/components/blocks/CardEvent.vue +14 -6
- package/src/modules/events/components/pages/EditEvent.vue +228 -133
- package/src/modules/events/components/sections/Feed.vue +7 -1
- package/src/modules/events/controllers/events.controller.js +9 -0
- package/src/modules/events/controllers/tickets.controller.js +2 -1
- package/src/modules/events/models/event.model.js +10 -0
- package/src/modules/events/store/events.js +15 -19
- package/src/modules/icons/entities/IconCommunity.vue +8 -0
- package/src/modules/organizations/components/blocks/CardOrganization.vue +3 -5
- package/src/modules/organizations/components/sections/Publics.vue +3 -3
- package/src/modules/organizations/controllers/organizations.controller.js +1 -1
- package/src/modules/organizations/organizations.client.js +0 -2
- package/src/modules/users/components/pages/Profile.vue +15 -4
- package/src/modules/users/components/pages/ProfileEvents.vue +3 -3
- package/src/modules/organizations/components/blocks/CardOrganizationSocial.vue +0 -46
- /package/src/modules/{community → constructor}/components/elements/Bullets.vue +0 -0
- /package/src/modules/{community → constructor}/components/elements/Caption.vue +0 -0
- /package/src/modules/{community → constructor}/components/elements/H2.vue +0 -0
- /package/src/modules/{community → constructor}/components/elements/Image.vue +0 -0
- /package/src/modules/{community → constructor}/components/elements/ImageUpload.vue +0 -0
package/package.json
CHANGED
@@ -8,7 +8,10 @@ const auth = [
|
|
8
8
|
path: 'auth',
|
9
9
|
name: 'Authentication',
|
10
10
|
meta: {
|
11
|
-
title:
|
11
|
+
title: {
|
12
|
+
en: 'Sign In',
|
13
|
+
ru: 'Вход'
|
14
|
+
},
|
12
15
|
},
|
13
16
|
component: layoutAuth,
|
14
17
|
children: [{
|
@@ -19,7 +22,10 @@ const auth = [
|
|
19
22
|
validationState.resetUser
|
20
23
|
],
|
21
24
|
meta: {
|
22
|
-
title:
|
25
|
+
title: {
|
26
|
+
en: 'Sign In',
|
27
|
+
ru: 'Вход'
|
28
|
+
},
|
23
29
|
},
|
24
30
|
component: () => import(/* webpackChunkName: "signin" */ '../components/pages/SignIn.vue'),
|
25
31
|
},{
|
@@ -30,7 +36,10 @@ const auth = [
|
|
30
36
|
validationState.resetUser
|
31
37
|
],
|
32
38
|
meta: {
|
33
|
-
title:
|
39
|
+
title: {
|
40
|
+
en: 'Reset Password',
|
41
|
+
ru: 'Сбросить Пароль'
|
42
|
+
},
|
34
43
|
},
|
35
44
|
component: () => import(/* webpackChunkName: "reset-password" */ '../components/pages/ResetPassword.vue'),
|
36
45
|
},{
|
@@ -41,7 +50,10 @@ const auth = [
|
|
41
50
|
validationState.resetUser
|
42
51
|
],
|
43
52
|
meta: {
|
44
|
-
title:
|
53
|
+
title: {
|
54
|
+
en: 'Sign Up',
|
55
|
+
ru: 'Регистрация'
|
56
|
+
},
|
45
57
|
},
|
46
58
|
component: () => import(/* webpackChunkName: "signup" */ '../components/pages/SignUp.vue'),
|
47
59
|
},{
|
@@ -52,7 +64,10 @@ const auth = [
|
|
52
64
|
validationState.checkUser
|
53
65
|
],
|
54
66
|
meta: {
|
55
|
-
title:
|
67
|
+
title: {
|
68
|
+
en: 'Enter Code',
|
69
|
+
ru: 'Введите Код'
|
70
|
+
},
|
56
71
|
},
|
57
72
|
component: () => import(/* webpackChunkName: "signup" */ '../components/pages/EnterCode.vue'),
|
58
73
|
},{
|
@@ -63,14 +78,20 @@ const auth = [
|
|
63
78
|
validationState.checkUser
|
64
79
|
],
|
65
80
|
meta: {
|
66
|
-
title:
|
81
|
+
title: {
|
82
|
+
en: 'Enter Password',
|
83
|
+
ru: 'Введите Пароль'
|
84
|
+
},
|
67
85
|
},
|
68
86
|
component: () => import(/* webpackChunkName: "signup" */ '../components/pages/EnterPassword.vue'),
|
69
87
|
},{
|
70
88
|
path: 'invite',
|
71
89
|
name: 'Invite',
|
72
90
|
meta: {
|
73
|
-
title:
|
91
|
+
title: {
|
92
|
+
en: 'Invite',
|
93
|
+
ru: 'Приглашение'
|
94
|
+
},
|
74
95
|
},
|
75
96
|
component: () => import(/* webpackChunkName: "signup" */ '../components/pages/Invite.vue'),
|
76
97
|
}],
|
@@ -11,12 +11,7 @@ import SubscribeNewsletter from './components/sections/SubscribeNewsletter.vue';
|
|
11
11
|
import JoinUs from './components/sections/JoinUs.vue';
|
12
12
|
import Comments from './components/sections/Comments.vue';
|
13
13
|
import HotPosts from './components/sections/HotPosts.vue';
|
14
|
-
|
15
|
-
import ImageUpload from './components/elements/ImageUpload.vue';
|
16
|
-
import H2 from './components/elements/H2.vue';
|
17
|
-
import Caption from './components/elements/Caption.vue';
|
18
|
-
import Image from './components/elements/Image.vue';
|
19
|
-
import Textarea from './components/elements/Textarea.vue';
|
14
|
+
|
20
15
|
|
21
16
|
// Importing Vuex store modules
|
22
17
|
import * as blogpostsStore from './store/blogposts.js';
|
@@ -39,12 +34,6 @@ export {
|
|
39
34
|
JoinUs,
|
40
35
|
Comments,
|
41
36
|
HotPosts,
|
42
|
-
Bullets,
|
43
|
-
ImageUpload,
|
44
|
-
H2,
|
45
|
-
Caption,
|
46
|
-
Image,
|
47
|
-
Textarea,
|
48
37
|
blogpostsStore,
|
49
38
|
reactionsStore,
|
50
39
|
blogpostsRoutes
|
@@ -75,7 +75,7 @@
|
|
75
75
|
import Publics from '@pf/src/modules/organizations/components/sections/Publics.vue'
|
76
76
|
import Comments from '@pf/src/modules/community/components/sections/Comments.vue';
|
77
77
|
|
78
|
-
import Image from '@pf/src/modules/
|
78
|
+
import Image from '@pf/src/modules/constructor/components/elements/Image.vue';
|
79
79
|
|
80
80
|
import * as blog from '@pf/src/modules/community/store/blogposts.js';
|
81
81
|
import * as auth from '@pf/src/modules/auth/store/auth';
|
@@ -17,55 +17,11 @@
|
|
17
17
|
class="h2"
|
18
18
|
/>
|
19
19
|
</div>
|
20
|
-
|
21
|
-
<
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
@start="handleDragStart"
|
26
|
-
@end="handleDragEnd"
|
27
|
-
>
|
28
|
-
<div
|
29
|
-
v-for="(block, index) in post.content"
|
30
|
-
:key="index"
|
31
|
-
class="relative"
|
32
|
-
|
33
|
-
>
|
34
|
-
<div
|
35
|
-
@mouseover="showControls = index, showMenu = false"
|
36
|
-
class="w-full h-full"
|
37
|
-
>
|
38
|
-
<component
|
39
|
-
:is="ComponentMap[block.type]"
|
40
|
-
:index="index"
|
41
|
-
:component="block"
|
42
|
-
:prop="block"
|
43
|
-
:class="block.class"
|
44
|
-
:setFocus="block.setFocus"
|
45
|
-
content="content"
|
46
|
-
@deleteBlock="handleDeleteBlock"
|
47
|
-
@addBlock="handleAddBlock"
|
48
|
-
@updateBlock="handleUpdateBlock"
|
49
|
-
|
50
|
-
/>
|
51
|
-
</div>
|
52
|
-
|
53
|
-
<transition name="fade">
|
54
|
-
<div
|
55
|
-
v-if="showControls === index"
|
56
|
-
class="pos-absolute pos-r-100 pos-t-0 z-index-4 i-semi"
|
57
|
-
@mousedown.prevent="startDragging = true"
|
58
|
-
>
|
59
|
-
<button @click="showMenu = !showMenu" class="mn-small w-100 i-semi bg-white radius-thin">{{ block.content ? '...' : '+' }}</button>
|
60
|
-
<div v-if="showMenu" class="z-index-5 radius-thin mn-small relative left-0 mt-2 w-max bg-white shadow-lg rounded">
|
61
|
-
<button @click="handleDeleteBlock(block)" class="block w-max text-left px-4 py-2 hover:bg-gray-200">Удалить</button>
|
62
|
-
<button @click="handleAddBlock('ImageUpload', '', index)" class="block w-max text-left px-4 py-2 hover:bg-gray-200">Добавить изображение</button>
|
63
|
-
<button @click="handleAddBlock('H2', '', index)" class="block w-max text-left px-4 py-2 hover:bg-gray-200">Добавить заголовок</button>
|
64
|
-
</div>
|
65
|
-
</div>
|
66
|
-
</transition>
|
67
|
-
</div>
|
68
|
-
</VueDraggableNext>
|
20
|
+
|
21
|
+
<Constructor
|
22
|
+
:content="post.content"
|
23
|
+
@update="update => post.content = update"
|
24
|
+
/>
|
69
25
|
</section>
|
70
26
|
|
71
27
|
<section v-if="post" class="pd-thin pos-fixed pos-l-0 pos-b-0 w-100 ">
|
@@ -112,26 +68,14 @@
|
|
112
68
|
</div>
|
113
69
|
<Button :submit="onSubmit" :callback="redirectTo" class="w-100 bg-black t-white">Publish</Button>
|
114
70
|
</div>
|
115
|
-
<!-- <DepartmentMemberModify
|
116
|
-
:members="departments.state.department.members"
|
117
|
-
:member="selectedMember"
|
118
|
-
:users="users"
|
119
|
-
@callback="closeMemberPopup"
|
120
|
-
/> -->
|
121
71
|
</Popup>
|
72
|
+
|
122
73
|
</article>
|
123
74
|
</template>
|
124
75
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
76
|
<script setup>
|
129
|
-
import Textarea from '@pf/src/modules/
|
130
|
-
import
|
131
|
-
import Caption from '@pf/src/modules/community/components/elements/Caption.vue';
|
132
|
-
import Bullets from '@pf/src/modules/community/components/elements/Bullets.vue';
|
133
|
-
import ImageUpload from '@pf/src/modules/community/components/elements/ImageUpload.vue';
|
134
|
-
|
77
|
+
import Textarea from '@pf/src/modules/constructor/components/elements/Textarea.vue';
|
78
|
+
import Constructor from '@pf/src/modules/constructor/components/sections/Constructor.vue';
|
135
79
|
|
136
80
|
import Popup from '@pf/src/components/Popup/Popup.vue'
|
137
81
|
import FieldTags from '@pf/src/components/FieldTags/FieldTags.vue'
|
@@ -306,93 +250,6 @@ function onDelete() {
|
|
306
250
|
});
|
307
251
|
}
|
308
252
|
}
|
309
|
-
|
310
|
-
// /////////////////////////////////////////
|
311
|
-
// CONSTRUCTOR
|
312
|
-
// /////////////////////////////////////////
|
313
|
-
|
314
|
-
const ComponentMap = {
|
315
|
-
'Textarea': Textarea,
|
316
|
-
'H2': H2,
|
317
|
-
'Bullets': Bullets,
|
318
|
-
'Caption': Caption,
|
319
|
-
'ImageUpload': ImageUpload
|
320
|
-
};
|
321
|
-
|
322
|
-
function handleAddBlock(type = 'Textarea', content = '', index, data) {
|
323
|
-
console.log('We are adding new block (functuin HandleAddBlock):' + type + content + index + data )
|
324
|
-
let blockNew = {
|
325
|
-
order: post.value.content.length + 1,
|
326
|
-
type: type,
|
327
|
-
style: '',
|
328
|
-
class: '',
|
329
|
-
content: content,
|
330
|
-
blocks: [],
|
331
|
-
setFocus: true,
|
332
|
-
};
|
333
|
-
|
334
|
-
if (data && data.blocks && Array.isArray(data.blocks)) {
|
335
|
-
let newBlocks = data.blocks.map(block => ({
|
336
|
-
...blockNew,
|
337
|
-
content: block.content,
|
338
|
-
|
339
|
-
}));
|
340
|
-
|
341
|
-
let args = [(data.index || index) + 1, 0].concat(newBlocks);
|
342
|
-
|
343
|
-
post.value.content.splice.apply(post.value.content, args);
|
344
|
-
|
345
|
-
const lastBlock = newBlocks[newBlocks.length - 1];
|
346
|
-
|
347
|
-
console.log('New block is' + lastBlock)
|
348
|
-
} else if (index !== undefined) {
|
349
|
-
post.value.content.splice(index + 1, 0, blockNew);
|
350
|
-
console.log('Latest block is' + blockNew)
|
351
|
-
} else {
|
352
|
-
console.log('Another block is' + blockNew)
|
353
|
-
post.value.content.push(blockNew);
|
354
|
-
}
|
355
|
-
|
356
|
-
showControls.value = null
|
357
|
-
}
|
358
|
-
|
359
|
-
function handleUpdateBlock(block, update) {
|
360
|
-
const index = post.value.content.findIndex(item => item === block);
|
361
|
-
|
362
|
-
if (index !== -1) {
|
363
|
-
post.value.content[index] = { ...post.value.content[index], ...update };
|
364
|
-
}
|
365
|
-
}
|
366
|
-
|
367
|
-
|
368
|
-
function handleDeleteBlock(block) {
|
369
|
-
let index = post.value.content.findIndex(b => b === block);
|
370
|
-
|
371
|
-
if (index !== -1) {
|
372
|
-
post.value.content.splice(index, 1);
|
373
|
-
}
|
374
|
-
|
375
|
-
post.value.content[index - 1].setFocus = true
|
376
|
-
}
|
377
|
-
|
378
|
-
// Добавлено из BlogConstructor
|
379
|
-
const showControls = ref(null)
|
380
|
-
const startDragging = ref(false)
|
381
|
-
const showMenu = ref(false)
|
382
|
-
|
383
|
-
function handleDragStart() {
|
384
|
-
startDragging.value = true
|
385
|
-
}
|
386
|
-
|
387
|
-
function handleDragEnd() {
|
388
|
-
startDragging.value = false
|
389
|
-
}
|
390
|
-
|
391
|
-
watchEffect(() => {
|
392
|
-
if (post.value && post.value.content.length === 0) {
|
393
|
-
handleAddBlock('Textarea', '');
|
394
|
-
}
|
395
|
-
});
|
396
253
|
</script>
|
397
254
|
|
398
255
|
|
@@ -4,31 +4,44 @@ const middlewareFactory = (db) => {
|
|
4
4
|
|
5
5
|
const checkBlogpostExistOrNot = async (req, res, next) => {
|
6
6
|
try {
|
7
|
-
|
8
|
-
|
7
|
+
// Обработка URL
|
8
|
+
const url = req.body.url
|
9
|
+
? req.body.url
|
9
10
|
: req.body.name.toLowerCase().replace(/ /g, '-').replace(/[^\w-]+/g, '');
|
10
11
|
|
11
|
-
//
|
12
|
+
// Создание блога
|
12
13
|
if (!req.body._id) {
|
13
|
-
|
14
|
+
const blogpost = await Blogpost.findOne({ url });
|
15
|
+
if (blogpost) {
|
16
|
+
res.status(400).send({ errorCode: 'POST_URL_ALREADY_IN_USE', accessToken: null });
|
17
|
+
return;
|
18
|
+
}
|
19
|
+
next();
|
14
20
|
return;
|
15
21
|
}
|
16
22
|
|
17
|
-
|
23
|
+
// Обновление блога
|
18
24
|
const updatingBlogpostId = req.body._id;
|
19
|
-
|
20
|
-
if (
|
21
|
-
res.status(
|
25
|
+
const existingBlogpost = await Blogpost.findById(updatingBlogpostId);
|
26
|
+
if (!existingBlogpost) {
|
27
|
+
res.status(404).send({ errorCode: 'BLOGPOST_NOT_FOUND', accessToken: null });
|
22
28
|
return;
|
23
29
|
}
|
24
|
-
|
30
|
+
if (existingBlogpost.url !== url) {
|
31
|
+
const blogpost = await Blogpost.findOne({ url });
|
32
|
+
if (blogpost) {
|
33
|
+
res.status(400).send({ errorCode: 'POST_URL_ALREADY_IN_USE', accessToken: null });
|
34
|
+
return;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
25
38
|
next();
|
26
39
|
} catch (err) {
|
27
40
|
console.log(err);
|
28
41
|
res.status(500).send({ message: err });
|
29
42
|
}
|
30
|
-
}
|
31
|
-
|
43
|
+
}
|
44
|
+
|
32
45
|
const checkNameNotEmpty = (req, res, next) => {
|
33
46
|
if (!req.body.name || req.body.name.trim() === '') {
|
34
47
|
res.status(400).send({ errorCode: "NAME_CANNOT_BE_EMPTY", accessToken: null });
|
@@ -15,15 +15,13 @@
|
|
15
15
|
<script setup="props">
|
16
16
|
import { computed, ref, onMounted, watch, nextTick, onUpdated, watchEffect } from 'vue'
|
17
17
|
|
18
|
-
const props = defineProps(
|
19
|
-
|
20
|
-
)
|
18
|
+
const props = defineProps(['prop','value','content','placeholder','index','setFocus'])
|
19
|
+
const emit = defineEmits(['deleteBlock', 'updateBlock','addBlock','focus'])
|
21
20
|
|
22
21
|
const data = ref(props)
|
23
22
|
const textarea = ref(null)
|
24
|
-
const emit = defineEmits(['deleteBlock', 'updateBlock','addBlock','focus'])
|
25
23
|
|
26
|
-
let cursorPosition = ref(0);
|
24
|
+
let cursorPosition = ref(0);
|
27
25
|
|
28
26
|
function handleInput(event) {
|
29
27
|
let paragraphs = event.target.value.split(/\n+/);
|
@@ -79,12 +77,6 @@
|
|
79
77
|
if (props.setFocus) nextTick(() => { { focus()} })
|
80
78
|
resize()
|
81
79
|
});
|
82
|
-
|
83
|
-
watch(() => props.prop[props.content], (newValue) => {
|
84
|
-
// if (newValue === "" && !newValue.includes("\n")) {
|
85
|
-
// emit('deleteBlock', props.prop)
|
86
|
-
// }
|
87
|
-
});
|
88
80
|
</script>
|
89
81
|
|
90
82
|
|
@@ -0,0 +1,167 @@
|
|
1
|
+
<template>
|
2
|
+
<!-- Content -->
|
3
|
+
<section>
|
4
|
+
<VueDraggableNext
|
5
|
+
v-if="post.content"
|
6
|
+
class="w-full"
|
7
|
+
:list="post.content"
|
8
|
+
@start="handleDragStart"
|
9
|
+
@end="handleDragEnd"
|
10
|
+
>
|
11
|
+
<div
|
12
|
+
v-for="(block, index) in post.content"
|
13
|
+
:key="index"
|
14
|
+
class="relative"
|
15
|
+
|
16
|
+
>
|
17
|
+
<div
|
18
|
+
@mouseover="showControls = index, showMenu = false"
|
19
|
+
class="w-full h-full"
|
20
|
+
>
|
21
|
+
<component
|
22
|
+
:is="ComponentMap[block.type]"
|
23
|
+
:index="index"
|
24
|
+
:component="block"
|
25
|
+
:prop="block"
|
26
|
+
:class="block.class"
|
27
|
+
:setFocus="block.setFocus"
|
28
|
+
content="content"
|
29
|
+
@deleteBlock="handleDeleteBlock"
|
30
|
+
@addBlock="handleAddBlock"
|
31
|
+
@updateBlock="handleUpdateBlock"
|
32
|
+
|
33
|
+
/>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<transition name="fade">
|
37
|
+
<div
|
38
|
+
v-if="showControls === index"
|
39
|
+
class="pos-absolute pos-r-100 pos-t-0 z-index-4 i-semi"
|
40
|
+
@mousedown.prevent="startDragging = true"
|
41
|
+
>
|
42
|
+
<button @click="showMenu = !showMenu" class="mn-small w-100 i-semi bg-white radius-thin">{{ block.content ? '...' : '+' }}</button>
|
43
|
+
<div v-if="showMenu" class="z-index-5 radius-thin mn-small relative left-0 mt-2 w-max bg-white shadow-lg rounded">
|
44
|
+
<button @click="handleDeleteBlock(block)" class="block w-max text-left px-4 py-2 hover:bg-gray-200">Удалить</button>
|
45
|
+
<button @click="handleAddBlock('ImageUpload', '', index)" class="block w-max text-left px-4 py-2 hover:bg-gray-200">Добавить изображение</button>
|
46
|
+
<button @click="handleAddBlock('H2', '', index)" class="block w-max text-left px-4 py-2 hover:bg-gray-200">Добавить заголовок</button>
|
47
|
+
</div>
|
48
|
+
</div>
|
49
|
+
</transition>
|
50
|
+
</div>
|
51
|
+
</VueDraggableNext>
|
52
|
+
</section>
|
53
|
+
</template>
|
54
|
+
|
55
|
+
|
56
|
+
<script setup>
|
57
|
+
import Textarea from '../elements/Textarea.vue';
|
58
|
+
import H2 from '../elements/H2.vue';
|
59
|
+
import Caption from '../elements/Caption.vue';
|
60
|
+
import Bullets from '../elements/Bullets.vue';
|
61
|
+
import ImageUpload from '../elements/ImageUpload.vue';
|
62
|
+
|
63
|
+
import { ref, watchEffect, computed, emit } from 'vue';
|
64
|
+
import { VueDraggableNext } from 'vue-draggable-next';
|
65
|
+
|
66
|
+
const props = defineProps(['content']);
|
67
|
+
const emits = defineEmits(['update'])
|
68
|
+
|
69
|
+
let post = ref(null);
|
70
|
+
let publics = ref(null);
|
71
|
+
|
72
|
+
post.value = { content: props.content }
|
73
|
+
|
74
|
+
const ComponentMap = {
|
75
|
+
'Textarea': Textarea,
|
76
|
+
'H2': H2,
|
77
|
+
'Bullets': Bullets,
|
78
|
+
'Caption': Caption,
|
79
|
+
'ImageUpload': ImageUpload
|
80
|
+
};
|
81
|
+
|
82
|
+
function handleAddBlock(type = 'Textarea', content = '', index, data) {
|
83
|
+
console.log('We are adding new block (functuin HandleAddBlock):' + type + content + index + data )
|
84
|
+
let blockNew = {
|
85
|
+
order: post.value.content.length + 1,
|
86
|
+
type: type,
|
87
|
+
style: '',
|
88
|
+
class: '',
|
89
|
+
content: content,
|
90
|
+
blocks: [],
|
91
|
+
setFocus: true,
|
92
|
+
};
|
93
|
+
|
94
|
+
if (data && data.blocks && Array.isArray(data.blocks)) {
|
95
|
+
let newBlocks = data.blocks.map(block => ({
|
96
|
+
...blockNew,
|
97
|
+
content: block.content,
|
98
|
+
|
99
|
+
}));
|
100
|
+
|
101
|
+
let args = [(data.index || index) + 1, 0].concat(newBlocks);
|
102
|
+
|
103
|
+
post.value.content.splice.apply(post.value.content, args);
|
104
|
+
|
105
|
+
const lastBlock = newBlocks[newBlocks.length - 1];
|
106
|
+
|
107
|
+
console.log('New block is' + lastBlock)
|
108
|
+
} else if (index !== undefined) {
|
109
|
+
post.value.content.splice(index + 1, 0, blockNew);
|
110
|
+
console.log('Latest block is' + blockNew)
|
111
|
+
} else {
|
112
|
+
console.log('Another block is' + blockNew)
|
113
|
+
post.value.content.push(blockNew);
|
114
|
+
}
|
115
|
+
|
116
|
+
showControls.value = null
|
117
|
+
emits('update', post.value.content);
|
118
|
+
}
|
119
|
+
|
120
|
+
function handleUpdateBlock(block, update) {
|
121
|
+
const index = post.value.content.findIndex(item => item === block);
|
122
|
+
|
123
|
+
if (index !== -1) {
|
124
|
+
post.value.content[index] = { ...post.value.content[index], ...update };
|
125
|
+
}
|
126
|
+
|
127
|
+
emits('update', post.value.content);
|
128
|
+
}
|
129
|
+
|
130
|
+
|
131
|
+
function handleDeleteBlock(block) {
|
132
|
+
let index = post.value.content.findIndex(b => b === block);
|
133
|
+
|
134
|
+
if (index !== -1) {
|
135
|
+
post.value.content.splice(index, 1);
|
136
|
+
}
|
137
|
+
|
138
|
+
post.value.content[index - 1].setFocus = true
|
139
|
+
|
140
|
+
emits('update', post.value.content);
|
141
|
+
}
|
142
|
+
|
143
|
+
const showControls = ref(null)
|
144
|
+
const startDragging = ref(false)
|
145
|
+
const showMenu = ref(false)
|
146
|
+
|
147
|
+
function handleDragStart() {
|
148
|
+
startDragging.value = true
|
149
|
+
}
|
150
|
+
|
151
|
+
function handleDragEnd() {
|
152
|
+
startDragging.value = false
|
153
|
+
}
|
154
|
+
|
155
|
+
watchEffect(() => {
|
156
|
+
if (post.value && post.value.content.length === 0) {
|
157
|
+
handleAddBlock('Textarea', '');
|
158
|
+
}
|
159
|
+
|
160
|
+
emits('update', post.value.content);
|
161
|
+
});
|
162
|
+
</script>
|
163
|
+
|
164
|
+
|
165
|
+
<style lang="scss">
|
166
|
+
|
167
|
+
</style>
|
@@ -74,12 +74,20 @@
|
|
74
74
|
</span>
|
75
75
|
</div>
|
76
76
|
|
77
|
-
<
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
77
|
+
<div v-if="type !== 'short'" class="cursor-pointer mn-thin flex-nowrap flex w-100">
|
78
|
+
|
79
|
+
<h3
|
80
|
+
v-if="type !== 'short'"
|
81
|
+
class=""
|
82
|
+
>
|
83
|
+
{{ event.name }}
|
84
|
+
</h3>
|
85
|
+
|
86
|
+
<div v-if="event.status === 'draft'" class="pd-micro t-white uppercase t-semi p-small flex-center flex pd-r-small pd-l-small mn-l-thin w-min bg-second radius-extra">
|
87
|
+
{{event.status}}
|
88
|
+
</div>
|
89
|
+
|
90
|
+
</div>
|
83
91
|
|
84
92
|
<p
|
85
93
|
v-if="type !== 'short'"
|