Merge branch 'editor' of gitlab.com:discoursio/discoursio-webapp into editor
# Conflicts: # src/components/Editor/Editor.tsx
This commit is contained in:
parent
5cce55de44
commit
32b53ae5cb
|
@ -1,3 +1,4 @@
|
||||||
|
import { createEffect } from 'solid-js'
|
||||||
import { createTiptapEditor, useEditorHTML } from 'solid-tiptap'
|
import { createTiptapEditor, useEditorHTML } from 'solid-tiptap'
|
||||||
import { clsx } from 'clsx'
|
import { clsx } from 'clsx'
|
||||||
import { useLocalize } from '../../context/localize'
|
import { useLocalize } from '../../context/localize'
|
||||||
|
|
|
@ -105,7 +105,7 @@ export const EditorBubbleMenu = (props: BubbleMenuProps) => {
|
||||||
type="text"
|
type="text"
|
||||||
placeholder={t('Enter URL address')}
|
placeholder={t('Enter URL address')}
|
||||||
autofocus
|
autofocus
|
||||||
value={prevUrl() ? prevUrl() : null}
|
value={prevUrl() ?? null}
|
||||||
onChange={(e) => setUrl(e.currentTarget.value)}
|
onChange={(e) => setUrl(e.currentTarget.value)}
|
||||||
/>
|
/>
|
||||||
<button type="submit">
|
<button type="submit">
|
||||||
|
|
22
src/components/Editor/TopicSelect/TopicSelect.scss
Normal file
22
src/components/Editor/TopicSelect/TopicSelect.scss
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
.TopicSelect .solid-select-list {
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
//.TopicSelect.solid-select-container {
|
||||||
|
// color: #fa7f25;
|
||||||
|
//}
|
||||||
|
//.TopicSelect .solid-select-control {
|
||||||
|
// outline-color: #fca560;
|
||||||
|
// border-color: #fca560;
|
||||||
|
//}
|
||||||
|
//.TopicSelect .solid-select-placeholder {
|
||||||
|
// color: #fca560;
|
||||||
|
//}
|
||||||
|
//.TopicSelect .solid-select-option:hover {
|
||||||
|
// background-color: #fa7f25;
|
||||||
|
// color: #fff;
|
||||||
|
//}
|
||||||
|
//.TopicSelect .solid-select-option[data-focused=true] {
|
||||||
|
// background-color: #fca560;
|
||||||
|
// color: #fff;
|
||||||
|
//}
|
|
@ -2,20 +2,36 @@ import type { Topic } from '../../../graphql/types.gen'
|
||||||
import { createOptions, Select } from '@thisbeyond/solid-select'
|
import { createOptions, Select } from '@thisbeyond/solid-select'
|
||||||
import { useLocalize } from '../../../context/localize'
|
import { useLocalize } from '../../../context/localize'
|
||||||
import '@thisbeyond/solid-select/style.css'
|
import '@thisbeyond/solid-select/style.css'
|
||||||
|
import './TopicSelect.scss'
|
||||||
|
|
||||||
type TopicSelectProps = {
|
type TopicSelectProps = {
|
||||||
topics: Topic[]
|
topics: Topic[]
|
||||||
|
selectedTopics: Topic[]
|
||||||
onChange: (selectedTopics: Topic[]) => void
|
onChange: (selectedTopics: Topic[]) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export const TopicSelect = (props: TopicSelectProps) => {
|
export const TopicSelect = (props: TopicSelectProps) => {
|
||||||
const { t } = useLocalize()
|
const { t } = useLocalize()
|
||||||
|
|
||||||
const selectProps = createOptions(props.topics, { key: 'title' })
|
const selectProps = createOptions(props.topics, {
|
||||||
|
key: 'title',
|
||||||
|
disable: (topic) => {
|
||||||
|
console.log({ selectedTopics: clone(props.selectedTopics) })
|
||||||
|
return props.selectedTopics.includes(topic)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const handleChange = (selectedTopics: Topic[]) => {
|
const handleChange = (selectedTopics: Topic[]) => {
|
||||||
props.onChange(selectedTopics)
|
props.onChange(selectedTopics)
|
||||||
}
|
}
|
||||||
|
|
||||||
return <Select multiple={true} {...selectProps} placeholder={t('Topics')} onChange={handleChange} />
|
return (
|
||||||
|
<Select
|
||||||
|
multiple={true}
|
||||||
|
{...selectProps}
|
||||||
|
placeholder={t('Topics')}
|
||||||
|
class="TopicSelect"
|
||||||
|
onChange={handleChange}
|
||||||
|
/>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,8 @@ type ShoutForm = {
|
||||||
slug: string
|
slug: string
|
||||||
title: string
|
title: string
|
||||||
subtitle: string
|
subtitle: string
|
||||||
topicSlugs: string[]
|
selectedTopics: Topic[]
|
||||||
|
mainTopic: Topic
|
||||||
body: string
|
body: string
|
||||||
coverImageUrl: string
|
coverImageUrl: string
|
||||||
}
|
}
|
||||||
|
@ -29,7 +30,8 @@ export const CreateView = () => {
|
||||||
slug: '',
|
slug: '',
|
||||||
title: '',
|
title: '',
|
||||||
subtitle: '',
|
subtitle: '',
|
||||||
topicSlugs: [],
|
selectedTopics: [],
|
||||||
|
mainTopic: null,
|
||||||
body: '',
|
body: '',
|
||||||
coverImageUrl: ''
|
coverImageUrl: ''
|
||||||
})
|
})
|
||||||
|
@ -121,8 +123,8 @@ export const CreateView = () => {
|
||||||
<Show when={topics()}>
|
<Show when={topics()}>
|
||||||
<TopicSelect
|
<TopicSelect
|
||||||
topics={topics()}
|
topics={topics()}
|
||||||
onChange={(selectedTopicSlugs) => setForm('topicSlugs', selectedTopics)}
|
onChange={(newSelectedTopics) => setForm('selectedTopics', newSelectedTopics)}
|
||||||
selectedTopicSlugs={form.topicSlugs}
|
selectedTopics={form.selectedTopics}
|
||||||
/>
|
/>
|
||||||
</Show>
|
</Show>
|
||||||
{/*<input type="text" name="topics" id="topics" placeholder="Темы" class="nolabel" />*/}
|
{/*<input type="text" name="topics" id="topics" placeholder="Темы" class="nolabel" />*/}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user