-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
153 additions
and
5 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
'use strict'; | ||
|
||
import React, { useCallback } from 'react'; | ||
import { useIntl } from 'react-intl'; | ||
|
||
import Popup from './popup'; | ||
import IconInsertRowAbove from '../../../res/icons/16/insert-row-above.svg'; | ||
import IconInsertRowBelow from '../../../res/icons/16/insert-row-below.svg'; | ||
import IconInsertColumnRight from '../../../res/icons/16/insert-column-right.svg'; | ||
import IconInsertColumnLeft from '../../../res/icons/16/insert-column-left.svg'; | ||
import IconDeleteRow from '../../../res/icons/16/delete-row.svg'; | ||
import IconDeleteColumn from '../../../res/icons/16/delete-column.svg'; | ||
import IconDeleteTable from '../../../res/icons/16/delete-table.svg'; | ||
|
||
function TablePopup({ parentRef, tableState }) { | ||
const intl = useIntl(); | ||
|
||
const handleInsertRowBefore = useCallback(() => { | ||
tableState.insertRowBefore(); | ||
}); | ||
const handleInsertRowAfter = useCallback(() => { | ||
tableState.insertRowAfter(); | ||
}); | ||
|
||
const handleColumnBefore = useCallback(() => { | ||
tableState.insertColumnBefore(); | ||
}); | ||
|
||
const handleColumnAfter = useCallback(() => { | ||
tableState.insertColumnAfter(); | ||
}); | ||
|
||
const handleDeleteColumn = useCallback(() => { | ||
tableState.deleteColumn(); | ||
}); | ||
|
||
const handleDeleteRow = useCallback(() => { | ||
tableState.deleteRow(); | ||
}); | ||
|
||
const handleDeleteTable = useCallback(() => { | ||
tableState.deleteTable(); | ||
}); | ||
|
||
return ( | ||
<Popup className="table-popup" parentRef={parentRef} pluginState={tableState.popup}> | ||
<button | ||
title={intl.formatMessage({ id: 'noteEditor.insertRowBefore' })} | ||
onClick={handleInsertRowBefore} | ||
> | ||
<div className="icon"><IconInsertRowAbove /></div> | ||
</button> | ||
<button | ||
title={intl.formatMessage({ id: 'noteEditor.insertRowAfter' })} | ||
onClick={handleInsertRowAfter} | ||
> | ||
<div className="icon"><IconInsertRowBelow /></div> | ||
</button> | ||
<button | ||
title={intl.formatMessage({ id: 'noteEditor.insertColumnBefore' })} | ||
onClick={handleColumnBefore} | ||
> | ||
<div className="icon"><IconInsertColumnLeft /></div> | ||
</button> | ||
<button | ||
title={intl.formatMessage({ id: 'noteEditor.insertColumnAfter' })} | ||
onClick={handleColumnAfter} | ||
> | ||
<div className="icon"><IconInsertColumnRight /></div> | ||
</button> | ||
<button | ||
title={intl.formatMessage({ id: 'noteEditor.deleteColumn' })} | ||
onClick={handleDeleteColumn} | ||
> | ||
<div className="icon"><IconDeleteColumn /></div> | ||
</button> | ||
<button | ||
title={intl.formatMessage({ id: 'noteEditor.deleteRow' })} | ||
onClick={handleDeleteRow} | ||
> | ||
<div className="icon"><IconDeleteRow /></div> | ||
</button> | ||
<button | ||
title={intl.formatMessage({ id: 'noteEditor.deleteTable' })} | ||
onClick={handleDeleteTable} | ||
> | ||
<div className="icon"><IconDeleteTable /></div> | ||
</button> | ||
</Popup> | ||
); | ||
} | ||
|
||
export default TablePopup; |