diff --git a/editors/editoria/src/config/config.js b/editors/editoria/src/config/config.js index 7b2f7d53cfcc57eff48a949bc7932d266ba30742..494fd58b296618d76f2695e6e6b01b9bddd7c1f7 100644 --- a/editors/editoria/src/config/config.js +++ b/editors/editoria/src/config/config.js @@ -34,6 +34,11 @@ import { SpecialCharactersToolGroupService, HighlightService, TextHighlightToolGroupServices, + EditorInfoToolGroupServices, + ShortcutToolGroupServices, + HelpToolGroupServices, + CounterInfoService, + BottomInfoService } from 'wax-prosemirror-services'; import { DefaultSchema } from 'wax-prosemirror-utilities'; @@ -88,6 +93,19 @@ export default { }, ], }, + { + templateArea: 'BottomRightInfo', + toolGroups: [ + { + name: 'InfoToolGroup', + more: [ + 'CounterInfoTool', + 'ShortcutTool', + 'HelpTool' + ], + }, + ], + }, ], SchemaService: DefaultSchema, @@ -139,5 +157,10 @@ export default { new SpecialCharactersToolGroupService(), new HighlightService(), new TextHighlightToolGroupServices(), + new EditorInfoToolGroupServices(), + new CounterInfoService(), + new BottomInfoService(), + new ShortcutToolGroupServices(), + new HelpToolGroupServices() ], }; diff --git a/editors/editoria/src/config/configMobile.js b/editors/editoria/src/config/configMobile.js index 150840c1542ef435692a6901ee2ff147e93c9eaa..ae05438c7ff3ff1a5d30ca48d4fb3e73b505a868 100644 --- a/editors/editoria/src/config/configMobile.js +++ b/editors/editoria/src/config/configMobile.js @@ -28,10 +28,13 @@ import { BlockDropDownToolGroupService, HighlightService, TextHighlightToolGroupServices, + EditorInfoToolGroupServices, + ShortcutToolGroupServices, + HelpToolGroupServices, + CounterInfoService, + BottomInfoService } from 'wax-prosemirror-services'; -import { DefaultSchema } from 'wax-prosemirror-utilities'; - import { WaxSelectionPlugin } from 'wax-prosemirror-plugins'; import invisibles, { @@ -60,9 +63,21 @@ export default { 'TrackChange', ], }, + { + templateArea: 'BottomRightInfo', + toolGroups: [ + { + name: 'InfoToolGroup', + more: [ + 'CounterInfoTool', + 'ShortcutTool', + 'HelpTool' + ], + }, + ], + }, ], - SchemaService: DefaultSchema, RulesService: [emDash, ellipsis], ShortCutsService: {}, EnableTrackChangeService: { enabled: false }, @@ -104,5 +119,10 @@ export default { new BlockDropDownToolGroupService(), new HighlightService(), new TextHighlightToolGroupServices(), + new EditorInfoToolGroupServices(), + new CounterInfoService(), + new BottomInfoService(), + new ShortcutToolGroupServices(), + new HelpToolGroupServices() ], }; diff --git a/editors/editoria/src/layout/EditoriaLayout.js b/editors/editoria/src/layout/EditoriaLayout.js index 7222febf38c03cd64f8be80bf1f3c1b9f9e419fa..272c38f706156bfed191cebdd6f1dc6df17cc1e4 100644 --- a/editors/editoria/src/layout/EditoriaLayout.js +++ b/editors/editoria/src/layout/EditoriaLayout.js @@ -160,7 +160,19 @@ const NotesContainer = styled.div` height: 100%; width: 65%; `; +const WaxBottomRightInfo= styled.div` +`; +const InfoContainer= styled.div` +display:flex; +position:fixed !important; +bottom:1px; +right:21px; +z-index:1; +`; +const InfoArea=styled.div` + +`; let surfaceHeight = 600; let notesHeight = 200; @@ -184,7 +196,7 @@ const NotesArea = ComponentPlugin('notesArea'); const RightArea = ComponentPlugin('rightArea'); const CommentTrackToolBar = ComponentPlugin('commentTrackToolBar'); const WaxOverlays = ComponentPlugin('waxOverlays'); - +const BottomRightInfo=ComponentPlugin('BottomRightInfo'); const EditoriaLayout = ({ editor }) => { const { view: { main }, @@ -209,6 +221,13 @@ const EditoriaLayout = ({ editor }) => { return ( <ThemeProvider theme={cokoTheme}> <Wrapper> + + <WaxBottomRightInfo> + <InfoContainer id="info-container"> + <BottomRightInfo/> + </InfoContainer> + </WaxBottomRightInfo> + <TopMenu> <MainMenuToolBar /> </TopMenu> diff --git a/editors/editoria/src/layout/EditoriaMobileLayout.js b/editors/editoria/src/layout/EditoriaMobileLayout.js index 5a51b110d0cfee6101396e33963689284350ef4b..6ca4687211f03f915830ea25d08ec92a1ad40587 100644 --- a/editors/editoria/src/layout/EditoriaMobileLayout.js +++ b/editors/editoria/src/layout/EditoriaMobileLayout.js @@ -147,7 +147,19 @@ const NotesContainer = styled.div` padding-right: ${grid(1)}; } `; +const WaxBottomRightInfo= styled.div` +`; +const InfoContainer= styled.div` +display:flex; +position:fixed !important; +bottom:1px; +right:21px; +z-index:1; +`; +const InfoArea=styled.div` + +`; let surfaceHeight = 500; let notesHeight = 150; @@ -194,6 +206,13 @@ const EditoriaLayout = ({ editor }) => { return ( <ThemeProvider theme={cokoTheme}> <Wrapper> + + <WaxBottomRightInfo> + <InfoContainer id="info-container"> + <BottomRightInfo/> + </InfoContainer> + </WaxBottomRightInfo> + <TopMenu> <TopBar /> </TopMenu> diff --git a/wax-prosemirror-components/index.js b/wax-prosemirror-components/index.js index 77d5da795d89ea16be527c60b192ca517c170fc1..8b4892acd39eea23e7db6b1487166818906e4241 100644 --- a/wax-prosemirror-components/index.js +++ b/wax-prosemirror-components/index.js @@ -18,3 +18,4 @@ export { default as FindAndReplaceTool } from './src/components/findAndReplace/F export { default as FullScreen } from './src/components/FullScreen'; export { default as SpecialCharactersTool } from './src/components/specialCharacters/SpecialCharactersTool'; export { default as TextHighlightingTool } from './src/components/textHighlight/TextHighlightingTool'; +export { default as EditorInfoTool} from './src/components/EditorInfo/CounterInfo/EditorInfoTool'; \ No newline at end of file diff --git a/wax-prosemirror-components/src/components/EditorInfo/CounterInfo/EditorInfoTool.js b/wax-prosemirror-components/src/components/EditorInfo/CounterInfo/EditorInfoTool.js new file mode 100644 index 0000000000000000000000000000000000000000..8bb1cfa24b66fe792a29e5a6424b752ba6ecc248 --- /dev/null +++ b/wax-prosemirror-components/src/components/EditorInfo/CounterInfo/EditorInfoTool.js @@ -0,0 +1,330 @@ +import React, { useMemo, useState, useRef, useContext, useEffect, useCallback } from 'react'; +import styled from 'styled-components'; +import { grid } from '@pubsweet/ui-toolkit'; +import { v4 as uuidv4 } from 'uuid'; +import { WaxContext } from 'wax-prosemirror-core'; +import { DocumentHelpers } from 'wax-prosemirror-utilities'; +import MenuButton from '../../../ui/buttons/MenuButton'; +import useOnClickOutside from '../../../helpers/useOnClickOutside'; + + +const Wrapper = styled.div` + font-size: 0; + position: relative; + z-index: 2; +`; + +const DropWrapper = styled.div` + margin-top: ${grid(1)}; + position: absolute; + background: white; + top: 32px; + width: max-content; +`; +const CounterInfoComponent = styled.div` + display: flex; + flex-direction: column; + background:white + border:1px solid gray; + position:fixed; + bottom:45px; + right:50px; +`; +const Counter = styled.div` + min-width: 150px; + height: 25px; + margin:5px; + display: block; + cursor: pointer; + color:black; + font-size:14px; +`; + +const EditorInfoTool = ({ view: { state }, item }) => { + const { title } = item; + const [isOpen, setIsOpen] = useState(false); + const [getWordCountFromState, setTotalWords] = useState(); + const [totalCharCount, setTotalCharCount] = useState(); + const [totalCharCountWithoutSpace, setTotalCharWithoutSpace] = useState(); + const [getSelectionCountFromState, setSelectedTextCount] = useState(); + const [paraCount, setTotalParagraph] = useState(); + const [imgCount, setImgCount] = useState(); + const [tableCount, setTableCount] = useState(); + const [footnoteCount, setFootNoteCount] = useState(); + const [blocklevelNode, setBlockLevelNodes] = useState(); + const ref = useRef(); + const {activeView } = useContext(WaxContext); + const allBlockNodes = DocumentHelpers.findBlockNodes(state.doc); + const InlineNodes = DocumentHelpers.findInlineNodes(state.doc); + + useOnClickOutside(ref, () => setIsOpen(false)); + + + const infoDropDownOptions = [ + { name: `${getWordCountFromState} Words` }, + { name: `${totalCharCount} Characters` }, + { name: `${totalCharCountWithoutSpace} Character Without Space` }, + { name: `${paraCount} Paragraph` }, + { name: `${imgCount} Images` }, + { name: `${tableCount} Tables` }, + { name: `${footnoteCount} Footnotes` }, + { name: `${blocklevelNode} Block-Level Nodes` }, + ]; + + const renderList = () => { + const lists = []; + + Object.keys(infoDropDownOptions).forEach(key=>{ + lists.push( + <Counter key={uuidv4()} + title={infoDropDownOptions[key].name}><span>{infoDropDownOptions[key].name}</span> + </Counter> + ); + }); + return <div>{lists}</div>; + }; + const getCount = useCallback(() => { + let getWordCountFromStates = 0; + InlineNodes.forEach(value => { + if (value.node.text !== undefined && value.node.text.length > 0) { + value.node.text.trim().split(" ").forEach((key, pos) => { + if (key.length > 0) { + getWordCountFromStates += 1; + } + }) + } + }) + return getWordCountFromStates + }); + const getCharCount = useCallback(() => { + let totalCharCounts = 0; + + InlineNodes.forEach(value => { + if (value.node.text !== undefined) { + totalCharCounts += value.node.text.length; + } + }) + + return totalCharCounts; + }); + const getCharCountWithoutSpace = useCallback(() => { + let totalCharCountWithoutSpaces = 0; + InlineNodes.forEach(value => { + if (value.node.text !== undefined) { + totalCharCountWithoutSpaces += value.node.text.replace(/\s+/g, '').length; + } + }) + + return totalCharCountWithoutSpaces; + }); + useEffect(() => { + let footNoteCount = 0; + let blockLevelCount = 0; + let paraCounts = 0; + let tableCounts = 0; + let imgCounts = 0; + let listTableCount = 0; + let nestTableCount = 0; + allBlockNodes.forEach(value => { + if (value.pos === 0) { + blockLevelCount = 0; + } + else { + blockLevelCount = allBlockNodes.length; + } + }) + setBlockLevelNodes(blockLevelCount); + allBlockNodes.forEach(value => { + value.node.forEach(imgs => { + if (imgs.type.name === "image") { + imgCounts += 1; + } + if (imgs.type.name === "footnote") { + footNoteCount += 1; + } + }) + + }) + state.doc.content.content.forEach(value => { + if (value.attrs.class === "paragraph" && value.content.size > 0) { + paraCounts += 1; + } + if (value.type.name === "table") { + tableCounts += 1; + } + value.content.content.forEach(listTable => { + listTable.content.content.forEach(lastListTable => { + if (lastListTable.type.name === "table") { + listTableCount += 1 + } + lastListTable.content.content.forEach(nestedTable => { + nestedTable.content.content.forEach(nestedTypeTable => { + if (nestedTypeTable.type.name === "table") { + nestTableCount += 1; + } + }) + }) + }) + }) + }) + setImgCount(imgCounts); + setTotalParagraph(paraCounts); + setTableCount(tableCounts + listTableCount + nestTableCount); + setFootNoteCount(footNoteCount); + setTotalCharCount(getCharCount()); + setTotalWords(getCount()); + setTotalCharWithoutSpace(getCharCountWithoutSpace()); + let selectedCountPara = 0; + let selectedCountList = 0; + let selectedCountNest = 0; + let noteTextValue = 0; + let footNodeCount = 0; + let selectedListTableCount = 0; + let finalNestedValueCount = 0; + activeView.state.selection.content().content.content.forEach(value => { + value.content.content.forEach((textValue) => { + if (textValue.text) { + const textArray = textValue.text.trim().split(" "); + let isChar = false; + textArray.forEach((key, pos) => { + // eslint-disable-next-line no-restricted-globals + if (key.charCodeAt(pos) !== 32 && isNaN(key.charCodeAt(pos))===false) { + isChar = true; + } + }) + if (isChar) { + selectedCountPara += textValue.text.trim().split(' ').length; + } + } + textValue.content.content.forEach(listValue => { + if (listValue.text && listValue.text !== ' ') { + const listArray = listValue.text.trim().split(' '); + let isFootChar = false; + listArray.forEach((key, pos) => { + if (key.charCodeAt(pos) !== 32) { + isFootChar = true; + } + }) + if (isFootChar) { + footNodeCount += listValue.text.trim().split(' ').length; + } + } + listValue.content.content.forEach(listItem => { + if (listItem.text && listItem.text !== ' ') { + const itemArray = listItem.text.trim().split(' '); + let isItemChar = false; + itemArray.forEach((key, pos) => { + // eslint-disable-next-line no-restricted-globals + if (key.charCodeAt(pos) !== 32 && isNaN(key.charCodeAt(pos))===false) { + isItemChar = true; + } + }) + if (isItemChar) { + selectedCountList += listItem.text.trim().split(' ').length; + } + } + listItem.content.content.forEach(nestedItem => { + nestedItem.content.content.forEach(nestIn => { + if (nestIn.text !== undefined) { + const nestArray = nestIn.text.trim().split(" "); + let isNestChar = false; + nestArray.forEach((key, pos) => { + // eslint-disable-next-line no-restricted-globals + if (key.charCodeAt(pos) !== 32 && isNaN(key.charCodeAt(pos))===false) { + isNestChar = true; + } + }) + if (nestIn.text && isNestChar) { + selectedCountNest += nestIn.text.trim().split(' ').length; + } + } + + nestIn.content.content.forEach(listTable => { + if (listTable.text !== undefined) { + const listTableArray = listTable.text.trim().split(' '); + let isListChar = false; + listTableArray.forEach((key, pos) => { + // eslint-disable-next-line no-restricted-globals + if (key.charCodeAt(pos) !== 32 && isNaN(key.charCodeAt(pos))===false) { + isListChar = true; + } + }) + if (listTable.text && isListChar) { + selectedListTableCount += listTable.text.trim().split(' ').length + } + } + + + listTable.content.content.forEach(tableValue => { + tableValue.content.content.forEach(finalTableValue => { + if (finalTableValue.text !== undefined) { + const finalTableArray = finalTableValue.text.trim().split(" ") + let isFinalTable = false; + finalTableArray.forEach((key, pos) => { + // eslint-disable-next-line no-restricted-globals + if (key.charCodeAt(pos) !== 32 && isNaN(key.charCodeAt(pos))===false) { + isFinalTable = true; + } + }) + if (finalNestedValueCount.text && isFinalTable) { + finalNestedValueCount = finalTableValue.text.trim().split(" ").length + } + } + }) + }) + }) + }) + }) + }) + }) + }) + if (value.text !== undefined) { + const valueArray = value.text.trim().split(" "); + let isValue = false; + valueArray.forEach((key, pos) => { + // eslint-disable-next-line no-restricted-globals + if (key.charCodeAt(pos) !== 32 && isNaN(key.charCodeAt(pos))===false) { + isValue = true; + } + }) + if (isValue) { + noteTextValue += value.text.trim().split(" ").length; + } + } + }); + setSelectedTextCount(selectedCountNest + finalNestedValueCount + selectedListTableCount + selectedCountPara + selectedCountList + noteTextValue + footNodeCount) + if (activeView.state.selection.$from.pos === activeView.state.selection.$to.pos) { + setSelectedTextCount(0); + } + + }) + const MenuButtonComponent = useMemo( + () => ( + <Wrapper ref={ref}> + + <MenuButton + active={isOpen} + disabled={false} + label={`${getSelectionCountFromState >0 ? getSelectionCountFromState : getWordCountFromState} + word${getSelectionCountFromState && getSelectionCountFromState > 1 ? 's' : ''}${!getSelectionCountFromState && getWordCountFromState > 1 ? 's' : ''}`} + onMouseDown={() => setIsOpen(true)} + title={title} + /> + + {isOpen && ( + <DropWrapper> + <CounterInfoComponent key={uuidv4()} item={item} view={state} + close={() => { + setIsOpen(false); + }}>{renderList()}</CounterInfoComponent> + </DropWrapper> + )} + </Wrapper> + ), + [isOpen, getWordCountFromState, getSelectionCountFromState], + ); + return MenuButtonComponent +}; + +export default EditorInfoTool; + diff --git a/wax-prosemirror-services/index.js b/wax-prosemirror-services/index.js index 43d5477f24692adc3544bf2c07c503ebae2e8f4c..cef4e07f00c02dcccaa9b26ba65cb5ad8686d8a1 100644 --- a/wax-prosemirror-services/index.js +++ b/wax-prosemirror-services/index.js @@ -32,7 +32,7 @@ export { default as FindAndReplaceService } from './src/FindAndReplaceService/Fi export { default as FullScreenService } from './src/FullScreenService/FullScreenService'; export { default as SpecialCharactersService } from './src/SpecialCharactersService/SpecialCharactersService'; export { default as HighlightService } from './src/HighlightService/HightlightService'; - +export { default as BottomInfoService } from './src/BottomInfoService/BottomInfoService'; /* ToolGroups */ @@ -51,4 +51,7 @@ export { default as BlockDropDownToolGroupService } from './src/WaxToolGroups/Bl export { default as TrackingAndEditingToolGroupService } from './src/WaxToolGroups/TrackingAndEditingToolGroupService/TrackingAndEditingToolGroupService'; export { default as FullScreenToolGroupService } from './src/WaxToolGroups/FullScreenToolGroupService/FullScreenToolGroupService'; export { default as SpecialCharactersToolGroupService } from './src/WaxToolGroups/SpecialCharactersToolGroupService/SpecialCharactersToolGroupService'; -export { default as TextHighlightToolGroupServices } from './src/WaxToolGroups/TextHighlightToolGroupService/TextHighlightToolGroupService'; \ No newline at end of file +export { default as TextHighlightToolGroupServices } from './src/WaxToolGroups/TextHighlightToolGroupService/TextHighlightToolGroupService'; +export { default as EditorInfoToolGroupServices } from './src/WaxToolGroups/BottomToolGroupService/InfoToolGroupService/EditorInfoToolGroupService'; +export { default as ShortcutToolGroupServices } from './src/WaxToolGroups/BottomToolGroupService/ShotcutToolGroupService/ShortcutToolGroupService'; +export {default as HelpToolGroupServices} from './src/WaxToolGroups/BottomToolGroupService/HelpToolGroupService/HelpToolGroupService'; diff --git a/wax-prosemirror-services/src/BottomInfoService/BottomInfoService.js b/wax-prosemirror-services/src/BottomInfoService/BottomInfoService.js new file mode 100644 index 0000000000000000000000000000000000000000..07cd3e5d8f5c5a639cbe6135a964888676e904a8 --- /dev/null +++ b/wax-prosemirror-services/src/BottomInfoService/BottomInfoService.js @@ -0,0 +1,8 @@ +import Service from "../Service"; +import BottomInfoServices from "./index"; + +class BottomInfoService extends Service { + dependencies = BottomInfoServices; +} + +export default BottomInfoService; diff --git a/wax-prosemirror-services/src/BottomInfoService/CounterInfoService/CounterInfoService.js b/wax-prosemirror-services/src/BottomInfoService/CounterInfoService/CounterInfoService.js new file mode 100644 index 0000000000000000000000000000000000000000..56f160afafcf70a605a8d592c6e3a65ac44ad650 --- /dev/null +++ b/wax-prosemirror-services/src/BottomInfoService/CounterInfoService/CounterInfoService.js @@ -0,0 +1,8 @@ +import Service from '../../Service' +import CounterInfoTool from "./CounterInfoTool" + +export default class CounterInfoService extends Service { + register() { + this.container.bind('CounterInfoTool').to(CounterInfoTool); + } +} diff --git a/wax-prosemirror-services/src/BottomInfoService/CounterInfoService/CounterInfoTool.js b/wax-prosemirror-services/src/BottomInfoService/CounterInfoService/CounterInfoTool.js new file mode 100644 index 0000000000000000000000000000000000000000..32084558a202498eb350e24e2c267c67531e3c93 --- /dev/null +++ b/wax-prosemirror-services/src/BottomInfoService/CounterInfoService/CounterInfoTool.js @@ -0,0 +1,34 @@ +import React from 'react'; +import { isEmpty } from 'lodash'; +import { injectable } from 'inversify'; +import { EditorInfoTool } from 'wax-prosemirror-components'; +// eslint-disable-next-line import/no-named-as-default,import/no-named-as-default-member +import Tools from '../../lib/Tools'; + + +@injectable() +class CounterInfoTool extends Tools { + title = 'Counter Info'; + icon = 'highlight'; + name = 'CounterInfo'; + + get run() { + return () => true; + } + + get enable() { + return state => { + return true; + }; + } + + renderTool(view) { + if (isEmpty(view)) return null; + // eslint-disable-next-line no-underscore-dangle + return this._isDisplayed ? ( + <EditorInfoTool key="CounterInfo" item={this.toJSON()} view={view} /> + ) : null; + } +} + +export default CounterInfoTool; \ No newline at end of file diff --git a/wax-prosemirror-services/src/BottomInfoService/HelpService/HelpService.js b/wax-prosemirror-services/src/BottomInfoService/HelpService/HelpService.js new file mode 100644 index 0000000000000000000000000000000000000000..4622ca474b0815fc50b5924af5d93c790c3a0746 --- /dev/null +++ b/wax-prosemirror-services/src/BottomInfoService/HelpService/HelpService.js @@ -0,0 +1,8 @@ +import Service from '../../Service' +import HelpTool from './HelpTool'; + +export default class HelpService extends Service { + register() { + this.container.bind('HelpTool').to(HelpTool); + } +} diff --git a/wax-prosemirror-services/src/BottomInfoService/HelpService/HelpTool.js b/wax-prosemirror-services/src/BottomInfoService/HelpService/HelpTool.js new file mode 100644 index 0000000000000000000000000000000000000000..a4c8df019b1497ab0b998c2e7894b537f800ceea --- /dev/null +++ b/wax-prosemirror-services/src/BottomInfoService/HelpService/HelpTool.js @@ -0,0 +1,16 @@ +import { injectable } from 'inversify'; +// eslint-disable-next-line import/no-named-as-default,import/no-named-as-default-member +import Tools from '../../lib/Tools'; + +@injectable() +class HelpTool extends Tools { + title = 'Help'; + icon = 'help'; + name = 'HelpTool'; + + get run() { + return () => true; + } +} + +export default HelpTool; \ No newline at end of file diff --git a/wax-prosemirror-services/src/BottomInfoService/ShortcutService/ShortcutService.js b/wax-prosemirror-services/src/BottomInfoService/ShortcutService/ShortcutService.js new file mode 100644 index 0000000000000000000000000000000000000000..17d9781cc86964585f04060306e42219ab22f338 --- /dev/null +++ b/wax-prosemirror-services/src/BottomInfoService/ShortcutService/ShortcutService.js @@ -0,0 +1,8 @@ +import Service from '../../Service' +import ShortcutTool from './ShortcutTool'; + +export default class ShortcutService extends Service { + register() { + this.container.bind('ShortcutTool').to(ShortcutTool); + } +} diff --git a/wax-prosemirror-services/src/BottomInfoService/ShortcutService/ShortcutTool.js b/wax-prosemirror-services/src/BottomInfoService/ShortcutService/ShortcutTool.js new file mode 100644 index 0000000000000000000000000000000000000000..01ff84fa7c49d59578eba32d120cdcec793c58f8 --- /dev/null +++ b/wax-prosemirror-services/src/BottomInfoService/ShortcutService/ShortcutTool.js @@ -0,0 +1,17 @@ +import { injectable } from 'inversify'; +// eslint-disable-next-line import/no-named-as-default,import/no-named-as-default-member +import Tools from '../../lib/Tools'; + +@injectable() +class ShortcutTool extends Tools { + title = 'Shortcut'; + icon = 'fullScreen'; + name = 'Shortcut'; + + get run() { + return () => true; + } + +} + +export default ShortcutTool; \ No newline at end of file diff --git a/wax-prosemirror-services/src/BottomInfoService/index.js b/wax-prosemirror-services/src/BottomInfoService/index.js new file mode 100644 index 0000000000000000000000000000000000000000..4a1f988a661b568ee34a5d5ee2b3b9558452c978 --- /dev/null +++ b/wax-prosemirror-services/src/BottomInfoService/index.js @@ -0,0 +1,4 @@ +import ShortcutService from './ShortcutService/ShortcutService'; +import HelpService from './HelpService/HelpService' + +export default [new ShortcutService(),new HelpService()]; \ No newline at end of file diff --git a/wax-prosemirror-services/src/WaxToolGroups/BottomToolGroupService/HelpToolGroupService/HelpTool.js b/wax-prosemirror-services/src/WaxToolGroups/BottomToolGroupService/HelpToolGroupService/HelpTool.js new file mode 100644 index 0000000000000000000000000000000000000000..f76952a212c5f16fac7e2ac4c4a13f42824a41ed --- /dev/null +++ b/wax-prosemirror-services/src/WaxToolGroups/BottomToolGroupService/HelpToolGroupService/HelpTool.js @@ -0,0 +1,16 @@ +import { injectable, inject } from 'inversify'; +import ToolGroup from '../../../lib/ToolGroup'; + +@injectable() +class HelpToolGroup extends ToolGroup { + tools = []; + constructor( + @inject('HelpTool') helptool, + ) { + + super(); + this.tools = [helptool]; + } +} + +export default HelpToolGroup; \ No newline at end of file diff --git a/wax-prosemirror-services/src/WaxToolGroups/BottomToolGroupService/HelpToolGroupService/HelpToolGroupService.js b/wax-prosemirror-services/src/WaxToolGroups/BottomToolGroupService/HelpToolGroupService/HelpToolGroupService.js new file mode 100644 index 0000000000000000000000000000000000000000..4fe68f3242184a941228b23ead23b069450b2bdf --- /dev/null +++ b/wax-prosemirror-services/src/WaxToolGroups/BottomToolGroupService/HelpToolGroupService/HelpToolGroupService.js @@ -0,0 +1,11 @@ +import Service from '../../../Service'; +// eslint-disable-next-line import/no-named-as-default,import/no-named-as-default-member +import HelpToolGroup from './HelpTool'; + +class HelpToolGroupServices extends Service { + name = "HelpToolGroupServices"; + register(){ + this.container.bind('HelpToolGroup').to(HelpToolGroup); + } +} +export default HelpToolGroupServices; \ No newline at end of file diff --git a/wax-prosemirror-services/src/WaxToolGroups/BottomToolGroupService/InfoToolGroupService/EditorInfoToolGroupService.js b/wax-prosemirror-services/src/WaxToolGroups/BottomToolGroupService/InfoToolGroupService/EditorInfoToolGroupService.js new file mode 100644 index 0000000000000000000000000000000000000000..4a8726b514d2ae0c29ec2761736c4df296cc02ec --- /dev/null +++ b/wax-prosemirror-services/src/WaxToolGroups/BottomToolGroupService/InfoToolGroupService/EditorInfoToolGroupService.js @@ -0,0 +1,11 @@ +import Service from '../../../Service'; +// eslint-disable-next-line import/no-named-as-default,import/no-named-as-default-member +import InfoToolGroup from './InfoTool'; + +class EditorInfoToolGroupServices extends Service { + name = "EditorInfoToolGroupServices"; + register(){ + this.container.bind('InfoToolGroup').to(InfoToolGroup); + } +} +export default EditorInfoToolGroupServices; \ No newline at end of file diff --git a/wax-prosemirror-services/src/WaxToolGroups/BottomToolGroupService/InfoToolGroupService/InfoTool.js b/wax-prosemirror-services/src/WaxToolGroups/BottomToolGroupService/InfoToolGroupService/InfoTool.js new file mode 100644 index 0000000000000000000000000000000000000000..5ada453cbac1acc51fa4fa325de5e839f8611593 --- /dev/null +++ b/wax-prosemirror-services/src/WaxToolGroups/BottomToolGroupService/InfoToolGroupService/InfoTool.js @@ -0,0 +1,18 @@ +import { injectable, inject } from 'inversify'; +import ToolGroup from '../../../lib/ToolGroup'; + +@injectable() +class InfoToolGroup extends ToolGroup { + tools = []; + constructor( + @inject('CounterInfoTool') counterinfotool, + @inject('ShortcutTool') shortcuttools, + @inject('HelpTool') helptool, + ) { + + super(); + this.tools = [counterinfotool,shortcuttools,helptool]; + } +} + +export default InfoToolGroup; \ No newline at end of file diff --git a/wax-prosemirror-services/src/WaxToolGroups/BottomToolGroupService/ShotcutToolGroupService/ShortcutTool.js b/wax-prosemirror-services/src/WaxToolGroups/BottomToolGroupService/ShotcutToolGroupService/ShortcutTool.js new file mode 100644 index 0000000000000000000000000000000000000000..fc0e4eafc03815624f4bf7e8ed175259f9448c81 --- /dev/null +++ b/wax-prosemirror-services/src/WaxToolGroups/BottomToolGroupService/ShotcutToolGroupService/ShortcutTool.js @@ -0,0 +1,16 @@ +import { injectable, inject } from 'inversify'; +import ToolGroup from '../../../lib/ToolGroup'; + +@injectable() +class ShortcutToolGroup extends ToolGroup { + tools = []; + constructor( + @inject('ShortcutTool') shortcuttool, + ) { + + super(); + this.tools = [shortcuttool]; + } +} + +export default ShortcutToolGroup; \ No newline at end of file diff --git a/wax-prosemirror-services/src/WaxToolGroups/BottomToolGroupService/ShotcutToolGroupService/ShortcutToolGroupService.js b/wax-prosemirror-services/src/WaxToolGroups/BottomToolGroupService/ShotcutToolGroupService/ShortcutToolGroupService.js new file mode 100644 index 0000000000000000000000000000000000000000..c3629ac9f1fa6913702d16735ec37a56c4a87be7 --- /dev/null +++ b/wax-prosemirror-services/src/WaxToolGroups/BottomToolGroupService/ShotcutToolGroupService/ShortcutToolGroupService.js @@ -0,0 +1,11 @@ +import Service from '../../../Service'; +// eslint-disable-next-line import/no-named-as-default,import/no-named-as-default-member +import ShortcutToolGroup from './ShortcutTool'; + +class ShortcutToolGroupServices extends Service { + name = "ShortcutToolGroupServices"; + register(){ + this.container.bind('ShortcutToolGroup').to(ShortcutToolGroup); + } +} +export default ShortcutToolGroupServices; \ No newline at end of file