Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dom-adapters): Inline tool adapter check for tool required data #87

Merged
merged 77 commits into from
Aug 30, 2024

Conversation

e11sy
Copy link
Contributor

@e11sy e11sy commented Aug 29, 2024

Now inline toolbar checks for data required in tool and renders data former element

packages/dom-adapters/src/FormattingAdapter/index.ts Outdated Show resolved Hide resolved
packages/core/src/ui/InlineToolbar/index.ts Outdated Show resolved Hide resolved
packages/core/src/ui/InlineToolbar/index.ts Outdated Show resolved Hide resolved
* Interface that represents return type of the renderActions function of the tool
* Contains rendered by tool renderActions with options for toolbar
*/
export interface DataFormElementWithOptions {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bad naming

* @returns rendered data form element with options required in toolbar
*/
public renderActions(callback: (data: InlineToolFormatData) => void): ActionsElementWithOptions | null {
const dataFormerElement = make('input') as HTMLInputElement;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const dataFormerElement = make('input') as HTMLInputElement;
const linkInput = make('input') as HTMLInputElement;

Comment on lines 119 to 128
const inlineElement = tool.createWrapper(toolData);

const extracted = range.extractContents();

/**
* Insert contents from range to new inline element and put created element in range
*/
inlineElement.appendChild(extracted);

range.insertNode(inlineElement);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be extracted to a separate method to re-use in #handleModelUpdate method as well

*/
public apply(toolName: InlineToolName): void {
public renderToolActions(nameOfTheTool: InlineToolName): void {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be public?

@e11sy e11sy enabled auto-merge August 30, 2024 15:27
@e11sy e11sy added this pull request to the merge queue Aug 30, 2024
Merged via the queue into main with commit 83662ff Aug 30, 2024
15 checks passed
@e11sy e11sy deleted the inline-tool-adapter branch August 30, 2024 15:48
nikmel2803 pushed a commit that referenced this pull request Aug 30, 2024
…87)

* Implmenet global CaretAdapter

* Handle native inputs

* Pass input type to Input component props

* Use class to represent index

* Fix lint in dom-adapters

* fix linter

* added inline tool adapter

* implement model updates

* lint fix

* fix index

* adapter renders inline tools

* lint fix and clean up

* jsdoc

* clean up

* jsdoc

* jsdoc

* surround content replaced

* suggestions

* lint fix

* jsdoc

* added bold and italic inline tools into core package

* naming

* naming

* added inline toolbar and inlineToolAdapter init into core

* update packages and lock

* build fix

* implement inline tool adapter to core

- fully implement current realization of inline tool adapter to core
- remove from the playground

* clean up

* jsdoc and naming improvements

* naming

* naming

* renaming

* fix hardcoded

* tools are initialized inside of the inline toolbar initialization

* fixed inline tool attaching

* jsdoc

* naming fix

* fixed imports

* lint fix

* try build fix

* install dependencies

* add sdk package

* fix build for core

* change package name in actions

* add references

* typo

* fix build

* added inline tool data former

* fix lint

* rm unwanted changes

* lint fix

* fixed build

* docs improved

* fix build

* naming improved

* Update packages/core/src/ui/InlineToolbar/index.ts

Co-authored-by: Peter <[email protected]>

* Update packages/dom-adapters/src/FormattingAdapter/index.ts

Co-authored-by: Peter <[email protected]>

* rm unwanted change

* naming

* separated renderToolActions and apply method in formatting adapter

* naming

* moved surround to utils

* lint fix

* last naming fix 🤞

* made renderToolActions method private

---------

Co-authored-by: George Berezhnoy <[email protected]>
Co-authored-by: George Berezhnoy <[email protected]>
Co-authored-by: Peter <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Aug 30, 2024
* fix tests

* use new method in the model

* add ci for collab manager

* lint fixes

* add getters for the index

* fix tests

* move methods to the document

* lint

* use helpers

* add tests

* Introduce DI & migrate tools builders (#80)

* Introduce DI & migrate tools builders

* Fixes after review

* 'Fix' lint

* Add unsaved files

* Fix comments

* Remove log & add docs

* Update packages/core/src/entities/UnifiedToolConfig.ts

Co-authored-by: Peter <[email protected]>

* Fixes after review

---------

Co-authored-by: Peter <[email protected]>

* Add BlockManager and EditorUI classes (#85)

* Add BlockManager and EditorUI classes

* Add JSDocs

* Add try catch for block.render() call

* feat(core): inputs content rendering (#86)

* passing formattingadapter to blocktooladapter

* lint

* Update BlockManager.ts

* Update BlockManager.ts

* Update App.vue

* Add Toolbox & ToolboxUI (#88)

* Add Toolbox & ToolboxUI

* Add comments

* Update tests for the model package

* Fix lint

* feat(dom-adapters): Inline tool adapter check for tool required data (#87)

* Implmenet global CaretAdapter

* Handle native inputs

* Pass input type to Input component props

* Use class to represent index

* Fix lint in dom-adapters

* fix linter

* added inline tool adapter

* implement model updates

* lint fix

* fix index

* adapter renders inline tools

* lint fix and clean up

* jsdoc

* clean up

* jsdoc

* jsdoc

* surround content replaced

* suggestions

* lint fix

* jsdoc

* added bold and italic inline tools into core package

* naming

* naming

* added inline toolbar and inlineToolAdapter init into core

* update packages and lock

* build fix

* implement inline tool adapter to core

- fully implement current realization of inline tool adapter to core
- remove from the playground

* clean up

* jsdoc and naming improvements

* naming

* naming

* renaming

* fix hardcoded

* tools are initialized inside of the inline toolbar initialization

* fixed inline tool attaching

* jsdoc

* naming fix

* fixed imports

* lint fix

* try build fix

* install dependencies

* add sdk package

* fix build for core

* change package name in actions

* add references

* typo

* fix build

* added inline tool data former

* fix lint

* rm unwanted changes

* lint fix

* fixed build

* docs improved

* fix build

* naming improved

* Update packages/core/src/ui/InlineToolbar/index.ts

Co-authored-by: Peter <[email protected]>

* Update packages/dom-adapters/src/FormattingAdapter/index.ts

Co-authored-by: Peter <[email protected]>

* rm unwanted change

* naming

* separated renderToolActions and apply method in formatting adapter

* naming

* moved surround to utils

* lint fix

* last naming fix 🤞

* made renderToolActions method private

---------

Co-authored-by: George Berezhnoy <[email protected]>
Co-authored-by: George Berezhnoy <[email protected]>
Co-authored-by: Peter <[email protected]>

* fix linter

---------

Co-authored-by: George Berezhnoy <[email protected]>
Co-authored-by: Peter <[email protected]>
Co-authored-by: e11sy <[email protected]>
Co-authored-by: George Berezhnoy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants