Skip to content

Commit

Permalink
Добавил больше цветов для форматирования текста
Browse files Browse the repository at this point in the history
  • Loading branch information
YarikMix committed May 8, 2024
1 parent 8b10b5a commit af2cb31
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 14 deletions.
59 changes: 56 additions & 3 deletions public/src/components/ColorPicker/ColorPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ import './ColorPicker.sass';

export class ColorPicker extends ScReact.Component<any, any> {
handleSelectText = (item: { label: any; color: any; }) => {

document.execCommand('foreColor', false, item.color)
this.props.onSel('color', item.color);
this.props.handleClose();
};

handleSelectBackground = (item: { label: any; color: any; }) => {

document.execCommand('backColor', false, item.color)
this.props.onSel('backgroundColor', item.color);
this.props.handleClose();
Expand All @@ -31,6 +29,30 @@ export class ColorPicker extends ScReact.Component<any, any> {
label: 'Синий',
color: 'rgb(37, 99, 235)'
},
{
label: 'Фиолетовый',
color: 'rgb(147, 51, 234)'
},
{
label: 'Желтый',
color: 'rgb(234, 179, 8)'
},
{
label: 'Зеленый',
color: 'rgb(0, 138, 0)'
},
{
label: 'Оранжевый',
color: 'rgb(255, 165, 0)'
},
{
label: 'Розовый',
color: 'rgb(186, 64, 129)'
},
{
label: 'Серый',
color: 'rgb(168, 162, 158)'
}
],
bg: [
{
Expand All @@ -45,6 +67,38 @@ export class ColorPicker extends ScReact.Component<any, any> {
label: 'Синий',
color: '#1a3d5c'
},
{
label: 'Фиолетовый',
color: '#3f2c4b'
},
{
label: 'Желтый',
color: '#5c4b1a'
},
{
label: 'Зеленый',
color: '#1a5c20'
},
{
label: 'Оранжевый',
color: '#5c3a1a'
},
{
label: 'Розовый',
color: '#5c1a3a'
},
{
label: 'Серый',
color: '#3a3a3a'
},
{
label: 'Синий',
color: '#1a3d5c'
},
{
label: 'Синий',
color: '#1a3d5c'
},
]
};

Expand All @@ -55,7 +109,6 @@ export class ColorPicker extends ScReact.Component<any, any> {
<div className="items">
{data.text.map(item => (
<div className="item" onmousedown={() => {

this.handleSelectText(item);
}}>
<div className="icon-container">
Expand Down
12 changes: 1 addition & 11 deletions public/src/modules/stores/NotesStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,10 @@ class NotesStore extends BaseStore<NotesStoreState> {
this.ws.onMessage((event) => {

let data = JSON.parse(event.data)

// if (data.username == AppUserStore.state.username) {
// return
// }

console.log(data)

if (data.type == "opened") {
const collaborator = {
Expand Down Expand Up @@ -367,19 +366,10 @@ class NotesStore extends BaseStore<NotesStoreState> {
async saveNote(data) {
try {

// const data = {
// id: this.state.selectedNote.id,
// note: AppNoteStore.state.note,
// parent: this.state.selectedNote.data.parent
//
// }

const {csrf} = await AppNoteRequests.Update(data, AppUserStore.state.JWT, AppUserStore.state.csrf);

AppDispatcher.dispatch(UserActions.UPDATE_CSRF, csrf);

localStorage.setItem("selectedNote", JSON.stringify(data))

} catch {
AppToasts.error('Что-то пошло не так');
}
Expand Down

0 comments on commit af2cb31

Please sign in to comment.