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

🚀 - Allow line height to be configured #552

Open
kedar-joshi opened this issue Aug 21, 2023 · 6 comments
Open

🚀 - Allow line height to be configured #552

kedar-joshi opened this issue Aug 21, 2023 · 6 comments
Assignees
Labels
feature New feature or request P2 This issue has medium priority wontfix This will not be worked on

Comments

@kedar-joshi
Copy link

Which @codeimage/* package(s) are relevant/releated to the feature request?

codeimage

Description

CodeImage is my preferred way of generating code screenshots and it's an amazing tool (so thank you so much 👍🏻).

However, sometimes I miss the ability to use custom line height for better readability. It would great if there is a was way to choose the line height for the code.

@kedar-joshi kedar-joshi added the feature New feature or request label Aug 21, 2023
@riccardoperra riccardoperra added this to the Backlog milestone Aug 21, 2023
@riccardoperra riccardoperra added the P2 This issue has medium priority label Aug 21, 2023
@riccardoperra
Copy link
Owner

riccardoperra commented Aug 21, 2023

Hi @kedar-joshi, we'll work on this issue in the next days.

Me and @hackpirodev are open to suggestions, my idea is to add a new field "Line height" in the editor options as a number input. The default value will be 1.4 (the current used value)

image


@hackpirodev

We need to add a new db column lineHeight to the SnippetEditorOptions table in order to persist this value for registered users.

Presets table use a json field to save the options then we don't have to update its structure...but we might have to update the mappers (I’m not sure about that, maybe a version upgrade is even not needed since this is not a breaking change)

@kedar-joshi
Copy link
Author

my idea is to add a new field "Line height" in the editor options as a number input. The default value will be 1.4 (the current used value)

That's perfect. 👍🏻

@riccardoperra
Copy link
Owner

riccardoperra commented Aug 22, 2023

@hackpirodev

Here some info for the development for the FE side:

  • The number input is not available yet on @codeui/kit, but there is a pending PR which I will complete next days.
    In order to use it you have to declare it and pass the required inputs to allows to update the line height correctly
import {NumberField} from '@codeui/kit';

<NumberField min={1} max={3} step={0.1}/>

I think you can try the current number field by moving to the pr branch from the codeimage repo (packages/kit)

  • We have to add the new lineHeight property into the editor.ts state, declaring the default value as 1.4
    export function getInitialEditorState(): EditorState {
    return {
    id: defaultId,
    code: appEnvironment.defaultState.editor.code,
    languageId: appEnvironment.defaultState.editor.languageId,
    tab: {
    tabName: 'index.tsx',
    tabIcon: undefined,
    },
    };
    }

    Then we have to add also the setter listener for statebuilder like the others one in order to be able to update this value
    .hold(store.commands.setEnableLigatures, (enable, {set}) =>
    set('options', 'enableLigatures', enable),
    )

    We also have to listen this command in order to execute the http call to update the project remotely
    const stateToPersist$ = from(
    store.watchCommand([
    store.commands.setFontId,
    store.commands.setThemeId,
    store.commands.setFontWeight,
    store.commands.setShowLineNumbers,
    store.commands.setEnableLigatures,
    editorUpdateCommand,
    ]),
    ).pipe(
    map(() => store()),
    map(mapToStateToPersistState),

    We must update the EditorPersistedState
    const mapToStateToPersistState = (
    to update the mapper.
    I think we'll have also to update the setFromPersistedState in order to extract the value from the http call response
    .hold(store.commands.setFromPersistedState, (persistedState, {state}) => {

@riccardoperra riccardoperra mentioned this issue Aug 22, 2023
4 tasks
@stale
Copy link

stale bot commented Oct 21, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Oct 21, 2023
@stale stale bot closed this as completed Oct 28, 2023
@riccardoperra riccardoperra reopened this Nov 6, 2023
@stale stale bot removed the wontfix This will not be worked on label Nov 6, 2023
Copy link

stale bot commented Feb 19, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Feb 19, 2024
@stale stale bot closed this as completed Feb 29, 2024
@riccardoperra riccardoperra reopened this Feb 29, 2024
@stale stale bot removed the wontfix This will not be worked on label Feb 29, 2024
Copy link

stale bot commented Jun 28, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request P2 This issue has medium priority wontfix This will not be worked on
Projects
Status: In Progress
Development

No branches or pull requests

3 participants