Skip to content
Snippets Groups Projects
Commit 055c037b authored by chris's avatar chris
Browse files

new track options service

parent 41ff84a6
No related branches found
No related tags found
1 merge request!226Ui components
...@@ -22,3 +22,4 @@ export { default as TextHighlightingTool } from './src/components/textHighlight/ ...@@ -22,3 +22,4 @@ export { default as TextHighlightingTool } from './src/components/textHighlight/
export { default as EditorInfoTool } from './src/components/EditorInfo/CounterInfo/EditorInfoTool'; export { default as EditorInfoTool } from './src/components/EditorInfo/CounterInfo/EditorInfoTool';
export { default as TransformCaseComponent } from './src/components/transformCase/TransformCaseComponent'; export { default as TransformCaseComponent } from './src/components/transformCase/TransformCaseComponent';
export { default as EditingSuggestingDropDown } from './src/components/editingSuggesting/EditingSuggestingDropDown'; export { default as EditingSuggestingDropDown } from './src/components/editingSuggesting/EditingSuggestingDropDown';
export { default as TrackChangeOptionsTool } from './src/components/trackChanges/TrackChangeOptionsTool';
/* eslint react/prop-types: 0 */
import React, { useState, useMemo } from 'react';
import MenuButton from '../../ui/buttons/MenuButton';
const HideShowTool = ({ view = {}, item, enabled }) => {
const [isEnabled, setEnabled] = useState(enabled);
const handleMouseDown = e => {
e.preventDefault();
setEnabled(!isEnabled);
item.run(view.state, view.dispatch);
};
const HideShowToolComponent = useMemo(
() => (
<MenuButton
active={isEnabled}
disabled={item.enable && !item.enable(view.state)}
label="Hide/Show"
onMouseDown={e => handleMouseDown(e)}
title={item.title}
/>
),
[isEnabled],
);
return HideShowToolComponent;
};
export default HideShowTool;
...@@ -36,6 +36,7 @@ export { default as CounterInfoService } from './src/BottomInfoService/CounterIn ...@@ -36,6 +36,7 @@ export { default as CounterInfoService } from './src/BottomInfoService/CounterIn
export { default as BottomInfoService } from './src/BottomInfoService/BottomInfoService'; export { default as BottomInfoService } from './src/BottomInfoService/BottomInfoService';
export { default as TransformService } from './src/TransformService/TransformService'; export { default as TransformService } from './src/TransformService/TransformService';
export { default as EditingSuggestingService } from './src/EditingSuggestingService/EditingSuggestingService'; export { default as EditingSuggestingService } from './src/EditingSuggestingService/EditingSuggestingService';
export { default as TrackOptionsService } from './src/TrackOptionsService/TrackOptionsService';
/* /*
ToolGroups ToolGroups
......
import Service from '../Service';
import TrackOptionsTool from './TrackOptionsTool';
class TrackOptionsService extends Service {
name = 'TrackOptionsService';
register() {
this.container.bind('TrackOptionsTool').to(TrackOptionsTool);
}
}
export default TrackOptionsService;
import React from 'react';
import { isEmpty } from 'lodash';
import { v4 as uuidv4 } from 'uuid';
import { injectable } from 'inversify';
import { TrackChangeOptionsTool } from 'wax-prosemirror-components';
import Tools from '../lib/Tools';
export default
@injectable()
class SpecialCharacters extends Tools {
title = 'Track Changes Options';
icon = 'more';
name = 'trackchangeoptions';
get run() {
return (state, dispatch) => {};
}
select = (state, activeViewId) => {};
get enable() {
return state => {
return true;
};
}
renderTool(view) {
if (isEmpty(view)) return null;
return this._isDisplayed ? (
<TrackChangeOptionsTool key={uuidv4()} item={this.toJSON()} view={view} />
) : null;
}
}
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