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(uip-editor): store editor state #780

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open

Conversation

fshovchko
Copy link
Collaborator

Closes: #617

@fshovchko fshovchko added the enhancement New feature or request label Jun 27, 2024
@fshovchko fshovchko self-assigned this Jun 27, 2024
@ala-n ala-n added this to the UIP 2.0.0 milestone Jul 2, 2024
Copy link
Contributor

@ala-n ala-n left a comment

Choose a reason for hiding this comment

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

There is a mixed responsibility issue in the current implementation:
UIPEditor is not a state-holder and should not interact with storage/modal (the actual state-holder) unless it's directly connected with user interaction.
Consider rework of EditorStore integration considering the following points:

  1. It should observe UIPModel directly or be integrated inside model and core
    1.2) Just in case there is a possibility to observe the actual initiator of change inside the core.
  2. Please be aware, that the initial state depends on setting it up inside the core. The editor store is only one of the sources, there is also an anchor and default snippet used as a source. The new logic should be in sync with them in terms of priority and execution time. The UIP should not be affected by extra update events as well.

@fshovchko fshovchko requested a review from ala-n July 3, 2024 12:01
# Conflicts:
#	src/core/base/root.ts
@ala-n
Copy link
Contributor

ala-n commented Nov 8, 2024

There are three small but critical points to accept this feature:

  1. As a consumer (Dev) I should be able to disable the feature
  2. As a user I expect to have a saved state for the exact playground instance (it will be very inconvenient if I found an example of lately opened component A when I open a page for component B that utilizes UIP as well)
  3. As a user (without deep knowledge) I should be able to reset to the snippet state (especially when there is no uip-snippet plugin)

To resolve mentioned problems I recommend the following action items:

  1. Rework model to use store ONLY IF the store-key declared on uip-root
  2. The store uses key store-key to identify the instance (it prewets any inconsistent sharing of the state)
  3. (Optional) We can propose a special keyword for user (e.g. PAGE) to use current full page pass to be used as a store key
  4. TECH NOTE: the exact browser storage root key should still be identified with uip- prefix
  5. Implement a reset button (for the plugin heading section) available for the editor plugin

@fshovchko fshovchko changed the title feat(uip-editor): store editor state (POC) feat(uip-editor): store editor state Nov 11, 2024
src/plugins/reset/reset-button.ts Outdated Show resolved Hide resolved
src/plugins/reset/reset-button.ts Outdated Show resolved Hide resolved
src/plugins/reset/reset-button.ts Outdated Show resolved Hide resolved
src/plugins/reset/reset-button.ts Outdated Show resolved Hide resolved
src/plugins/reset/reset-button.less Outdated Show resolved Hide resolved
src/core/base/model.ts Outdated Show resolved Hide resolved
src/core/base/model.ts Outdated Show resolved Hide resolved
src/core/base/model.ts Outdated Show resolved Hide resolved
src/core/base/model.storage.ts Outdated Show resolved Hide resolved
@fshovchko fshovchko requested a review from ala-n December 10, 2024 15:50
src/core/base/source.d.ts Outdated Show resolved Hide resolved
src/core/base/state.storage.ts Outdated Show resolved Hide resolved
src/core/base/state.storage.ts Outdated Show resolved Hide resolved
src/core/base/state.storage.ts Outdated Show resolved Hide resolved
@fshovchko fshovchko requested a review from ala-n December 13, 2024 13:14
src/core/base/state.storage.ts Outdated Show resolved Hide resolved
src/core/base/state.storage.ts Outdated Show resolved Hide resolved
src/core/base/state.storage.ts Outdated Show resolved Hide resolved
@ala-n ala-n requested review from abarmina and NastaLeo December 20, 2024 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[🚀core]: POC - ability to store last editor state
3 participants