Skip to content
Snippets Groups Projects
Commit 757a3b74 authored by chris's avatar chris
Browse files

change placeholder plus add title to fullscreen button

parent e733d96c
No related branches found
No related tags found
No related merge requests found
Pipeline #55299 passed with stages
in 3 minutes and 13 seconds
/* eslint react/prop-types: 0 */
import React, { useContext, useMemo } from 'react';
import { isEmpty } from 'lodash';
import { useTranslation } from 'react-i18next';
import { TextSelection } from 'prosemirror-state';
import { WaxContext, MenuButton } from 'wax-prosemirror-core';
const FullScreenButton = ({ view = {}, item }) => {
const { active, icon, select } = item;
const { t, i18n } = useTranslation();
const { active, icon, label, select, title } = item;
const context = useContext(WaxContext);
const { activeViewId, activeView, options } = context;
......@@ -27,8 +30,8 @@ const FullScreenButton = ({ view = {}, item }) => {
};
const usedIcon = options.fullScreen ? 'fullScreenExit' : icon;
const titleToshow = options.fullScreen ? 'Exit full screen' : title;
const isActive = active(state, activeViewId) && select(state, activeViewId);
const isDisabled = !select(state, activeViewId, activeView);
const MenuButtonComponent = useMemo(
......@@ -37,10 +40,16 @@ const FullScreenButton = ({ view = {}, item }) => {
active={false}
disabled={false}
iconName={usedIcon}
label={label}
onMouseDown={e => handleMouseDown(e)}
title={
!isEmpty(i18n) && i18n.exists(`Wax.Various.${titleToshow}`)
? t(`Wax.Various.${titleToshow}`)
: titleToshow
}
/>
),
[isActive, isDisabled, usedIcon],
[isActive, isDisabled, usedIcon, t(`Wax.Annotations.${title}`)],
);
return MenuButtonComponent;
......
......@@ -66,7 +66,7 @@ const QuestionData = styled.div`
flex-direction: row;
.ProseMirror {
:empty::before {
content: 'Type your answer';
content: 'Type option';
color: #aaa;
float: left;
font-style: italic;
......@@ -238,7 +238,7 @@ export default ({ node, view, getPos }) => {
<EditorComponent
getPos={getPos}
node={node}
placeholderText="Type your answer"
placeholderText="Type option"
view={view}
/>
</QuestionData>
......
......@@ -66,7 +66,7 @@ const QuestionData = styled.div`
flex-direction: row;
.ProseMirror {
:empty::before {
content: 'Type your answer';
content: 'Type option';
color: #aaa;
float: left;
font-style: italic;
......@@ -238,7 +238,7 @@ export default ({ node, view, getPos }) => {
<EditorComponent
getPos={getPos}
node={node}
placeholderText="Type your answer"
placeholderText="Type option"
view={view}
/>
</QuestionData>
......
......@@ -66,7 +66,7 @@ const QuestionData = styled.div`
flex-direction: row;
.ProseMirror {
:empty::before {
content: 'Type your answer';
content: 'Type option';
color: #aaa;
float: left;
font-style: italic;
......@@ -238,7 +238,7 @@ export default ({ node, view, getPos }) => {
<EditorComponent
getPos={getPos}
node={node}
placeholderText="Type your answer"
placeholderText="Type option"
view={view}
/>
</QuestionData>
......
......@@ -66,7 +66,7 @@ const QuestionData = styled.div`
flex-direction: row;
.ProseMirror {
:empty::before {
content: 'Type your answer';
content: 'Type option';
color: #aaa;
float: left;
font-style: italic;
......@@ -236,7 +236,7 @@ export default ({ node, view, getPos }) => {
<EditorComponent
getPos={getPos}
node={node}
placeholderText="type your answer"
placeholderText="Type option"
view={view}
/>
</QuestionData>
......
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