Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
11c0405
the popover component, vertical toolbox
neSpecc Jan 13, 2022
015f409
toolbox position improved
neSpecc Jan 13, 2022
229b9a2
popover width improved
neSpecc Jan 13, 2022
9a15cf5
always show the plus button
neSpecc Feb 2, 2022
3a3403e
search field added
neSpecc Feb 5, 2022
06a5766
Merge branch 'next' into feat/vertical-toolbox
neSpecc Feb 10, 2022
a020ca5
search input in popover
neSpecc Mar 2, 2022
a005b07
trying to create mobile toolbox
neSpecc Mar 12, 2022
e7b2698
Merge branch 'next' into feat/vertical-toolbox
neSpecc Mar 13, 2022
33b848f
FIx mobile popover fixed positioning
TatianaFomina Mar 13, 2022
87221cf
Add mobile popover overlay
TatianaFomina Mar 13, 2022
0057915
Hide mobile popover on scroll
TatianaFomina Mar 14, 2022
435976f
Tmp
TatianaFomina Mar 15, 2022
2bc1427
Merge branch 'next' into feat/vertical-toolbox
neSpecc Apr 5, 2022
c29d244
feat(toolbox): popover adapted for mobile devices (#2004)
TatianaFomina Apr 7, 2022
f947d36
Vertical toolbox fixes (#2017)
TatianaFomina Apr 14, 2022
5e00998
Extend element interface to avoid ts errors
TatianaFomina Apr 16, 2022
f3e253f
Do not subscribe to block hovered if mobile
TatianaFomina Apr 16, 2022
262baee
Add unsubscribing from overlay click event
TatianaFomina Apr 16, 2022
0c006d6
Rename isMobile to isMobileScreen
TatianaFomina Apr 16, 2022
adb8b77
Cleanup
TatianaFomina Apr 16, 2022
ae2ac42
fix: popover opening direction (#2022)
TatianaFomina Apr 17, 2022
d44b9a9
Update src/components/flipper.ts
TatianaFomina Apr 17, 2022
83a8c86
Fixes
TatianaFomina Apr 17, 2022
054f23d
Merge branch 'next' into feat/vertical-toolbox
TatianaFomina Apr 17, 2022
6a31e72
Merge branch 'feat/vertical-toolbox' of https://github.com/codex-team…
TatianaFomina Apr 17, 2022
2bc4c80
Fix test
TatianaFomina Apr 17, 2022
b43a22a
Clear search on popover hide
TatianaFomina Apr 18, 2022
7c2cb80
Fix popover width
TatianaFomina Apr 18, 2022
9c2d665
Fix for tests
TatianaFomina Apr 18, 2022
ede63a4
Update todos
TatianaFomina Apr 18, 2022
b5dd459
Linter fixes
TatianaFomina Apr 19, 2022
061b2c9
rm todo about beforeInsert
neSpecc Apr 19, 2022
ca7b2ab
i18n for search labels done
neSpecc Apr 19, 2022
cc0530c
rm methods for hiding/showing of +
neSpecc Apr 19, 2022
c36eca2
some code style update
neSpecc Apr 19, 2022
3a98e9b
Merge branch 'next' into feat/vertical-toolbox
neSpecc Apr 22, 2022
04376f9
Update CHANGELOG.md
neSpecc Apr 22, 2022
25b06c0
make the list items a little bit compact
neSpecc Apr 22, 2022
70fd937
fix z-index issue caused by block-appearing animation
neSpecc Apr 22, 2022
52ca7cd
Merge branch 'feat/vertical-toolbox' into feat/vertical-toolbox-multi…
TatianaFomina Apr 24, 2022
b165f8c
Merge branch 'next' into feat/vertical-toolbox-multiple-items
TatianaFomina Apr 27, 2022
2f7312c
Some progress
TatianaFomina Apr 28, 2022
41b7afa
Merge branch 'next' into feat/vertical-toolbox-multiple-items
TatianaFomina May 4, 2022
497c5a9
Cleanup
TatianaFomina May 4, 2022
bc00939
Proceed cleanup
TatianaFomina May 4, 2022
64e12c6
Update tool-settings.d.ts
TatianaFomina May 4, 2022
16c4462
Get rid of isToolboxItemActive
TatianaFomina May 10, 2022
47a0d58
Get rid of key
TatianaFomina May 12, 2022
d01bfec
Filter out duplicates in conversion menu
TatianaFomina May 12, 2022
c6417b0
Rename hash to id
TatianaFomina May 13, 2022
22259eb
Change function for generating hash
TatianaFomina May 15, 2022
ebe55e6
Cleanup
TatianaFomina May 15, 2022
0ddc09d
Further cleanup
TatianaFomina May 15, 2022
6b60cb1
[Feature] Multiple toolbox items: using of data overrides instead of …
neSpecc May 18, 2022
359aead
rename toolbox types, simplify hasTools method
neSpecc May 19, 2022
5a495de
add empty line
neSpecc May 19, 2022
3b44fec
wrong line
neSpecc May 19, 2022
d6a6172
add multiple toobox note to the doc
neSpecc May 19, 2022
b5261e6
Update toolbox configs merge logic
TatianaFomina May 23, 2022
5ad2871
Merge branch 'next' into feat/vertical-toolbox-multiple-items
TatianaFomina May 23, 2022
505a8a6
Add a test case
TatianaFomina May 23, 2022
13795c1
Add toolbox ui tests
TatianaFomina May 24, 2022
920bccf
Update tests
TatianaFomina May 26, 2022
f8b004c
upd doc
neSpecc May 26, 2022
37f93c8
Update header
neSpecc May 26, 2022
b11d216
Update changelog and package.json
TatianaFomina May 27, 2022
0826354
Merge branch 'feat/vertical-toolbox-multiple-items' of https://github…
TatianaFomina May 27, 2022
223d12f
Update changelog
TatianaFomina May 27, 2022
8eb4f6b
Update jsdoc
TatianaFomina May 27, 2022
86aedf5
Remove unused dependency
TatianaFomina May 29, 2022
59c6a5f
Make BlockTool's toolbox getter always return an array
TatianaFomina Jun 2, 2022
dff1df2
Fix for unconfigured toolbox
TatianaFomina Jun 2, 2022
840c5f5
Revert "Fix for unconfigured toolbox"
TatianaFomina Jun 2, 2022
f2fe90b
Change return type
TatianaFomina Jun 2, 2022
eb0a59c
Merge data overrides with actual block data when inserting a block
TatianaFomina Jun 5, 2022
0010058
Revert "Merge data overrides with actual block data when inserting a …
TatianaFomina Jun 10, 2022
38616ae
Merge tool's data with data overrides
TatianaFomina Jun 10, 2022
852dfa6
Move merging block data with data overrides to insertNewBlock
TatianaFomina Jun 17, 2022
bb3bd8f
Update changelog
TatianaFomina Jun 17, 2022
05df909
Rename getDefaultBlockData to composeBlockData
TatianaFomina Jun 17, 2022
3cd8c87
Create block data on condition
TatianaFomina Jun 17, 2022
6835b3b
Update types/api/blocks.d.ts
TatianaFomina Jun 17, 2022
adce210
Update src/components/modules/api/blocks.ts
TatianaFomina Jun 17, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/components/modules/api/blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { BlockToolData, OutputData, ToolConfig } from '../../../../types';
import * as _ from './../../utils';
import BlockAPI from '../../block/api';
import Module from '../../__module';
import Block from '../../block';

/**
* @class BlocksAPI
Expand Down Expand Up @@ -31,6 +32,7 @@ export default class BlocksAPI extends Module {
insertNewBlock: (): void => this.insertNewBlock(),
insert: this.insert,
update: this.update,
composeBlockData: this.composeBlockData,
};
}

Expand Down Expand Up @@ -247,6 +249,27 @@ export default class BlocksAPI extends Module {
return new BlockAPI(insertedBlock);
}

/**
* Retrieves default block data by creating fake block.
Comment thread
TatianaFomina marked this conversation as resolved.
Outdated
* Merges retrieved data with specified data object.
*
* @param toolName - block tool name
* @param dataOverrides - object containing overrides for default block data
*/
public composeBlockData = async (toolName: string, dataOverrides = {}): Promise<BlockToolData> => {
const tool = this.Editor.Tools.blockTools.get(toolName);
const block = new Block({
tool,
api: this.Editor.API,
readOnly: true,
data: {},
tunesData: {},
});
const blockData = await block.data;

return Object.assign(blockData, dataOverrides);
Comment thread
neSpecc marked this conversation as resolved.
Outdated
}

/**
* Insert new Block
* After set caret to this Block
Expand Down
9 changes: 7 additions & 2 deletions src/components/ui/toolbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ export default class Toolbox extends EventsDispatcher<ToolboxEvent> {
* @param {string} toolName - Tool name
* @param blockDataOverrides - predefined Block data
*/
private insertNewBlock(toolName: string, blockDataOverrides?: BlockToolData): void {
private async insertNewBlock(toolName: string, blockDataOverrides?: BlockToolData): Promise<void> {
const currentBlockIndex = this.api.blocks.getCurrentBlockIndex();
const currentBlock = this.api.blocks.getBlockByIndex(currentBlockIndex);

Expand All @@ -393,9 +393,14 @@ export default class Toolbox extends EventsDispatcher<ToolboxEvent> {
*/
const index = currentBlock.isEmpty ? currentBlockIndex : currentBlockIndex + 1;

/**
* Merge real tool's data with data overrides
*/
const actualData = await this.api.blocks.composeBlockData(toolName, blockDataOverrides);

const newBlock = this.api.blocks.insert(
toolName,
blockDataOverrides,
actualData,
undefined,
index,
undefined,
Expand Down
9 changes: 9 additions & 0 deletions types/api/blocks.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ export interface Blocks {
): BlockAPI;


/**
* Retrieves default block data by creating fake block.
Comment thread
TatianaFomina marked this conversation as resolved.
Outdated
* Merges retrieved data with specified data object.
*
* @param toolName - block tool name
* @param dataOverrides - object containing overrides for default block data
*/
composeBlockData(toolName: string, dataOverrides: BlockToolData): Promise<BlockToolData>

/**
* Updates block data by id
*
Expand Down