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

Make editing grading instructions available #3915

Open
wants to merge 27 commits into
base: master
Choose a base branch
from

Conversation

pejuam
Copy link
Contributor

@pejuam pejuam commented Aug 23, 2024

No description provided.

@pejuam pejuam force-pushed the feature/editable-grading-instructions branch from 088d488 to 391d6a5 Compare August 23, 2024 05:23
export interface GradingInstructionProps {
children?: React.ReactNode
editable?: boolean
onChange?: (answerHTML: string, displayNumber?: string) => void
Copy link
Contributor

Choose a reason for hiding this comment

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

Nyt kun komponentin nimi on geneerisempi, onChange (ja ehkä jopa saveScreenshot)
on turhan epätarkkoja termejä.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

En saa tästä kiinni, mutta ehdota toki parempia termejä.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ootas.. tutkitaan:

<GradingInstructions onChange={} onSavescreenshot={}/>

Ehkä toi menee vielä. Ajattelin siis jos tuohon GradingInstructions:iin tulisi muitakin callbackejä jotka ei liittyisi editointiin niin noi voisi olla hämäriä.

Copy link
Contributor

Choose a reason for hiding this comment

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

Eiku onhan GradingInstructionsilla vaikka kuinka paljon muitakin callbackeja:

<GradingInstructions onChange={} onSavescreenshot={} resolveAttachment={} onClickAnnotation={} onSaveAnnotation={}/>

Ehkä toi onChange voisi olla jotain muuta. Esim onContentChange jos ei parempaa keksi?

Copy link
Contributor

Choose a reason for hiding this comment

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

onEdit ?

screenshotImageSelector: 'img[src^="data:image/png"], img[src^="data:image/jpeg"]',
fileTypes: ['image/png', 'image/jpeg']
},
({ answerHTML }) => (onChange ? onChange(answerHTML, displayNumber) : () => {})
Copy link
Contributor

Choose a reason for hiding this comment

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

on change ja save screenshot lienee pakollisia tässä komponentissa?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Kyllä, mutta se hyödyntää GradingInstructionPropsia ja sinne en laittaisi noita pakollisiksi, kun hvp:t ei ole joka paikassa editoitavia eikä noilla callbackeilla ole silloin käyttöä.

Copy link
Contributor

Choose a reason for hiding this comment

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

niin tää johtuu siitä että meidän GradingInstruction:lla on samat propsit kuin contextilla. Usein näin ei ole mutta meidän tapauksessa on. Tää on tää vanha juttu et onko oma tyyppi vai ? parempi. Käy näinkin

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ehkä ne voisi silti erottaa toisistaan. Katsotaan.

Copy link
Contributor

Choose a reason for hiding this comment

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

muistaakseni typescriptiä voi kikkailla silleen, että onChange olisi pakollinen vain sillon kun editable on true.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

En jotenkin lämpene tälle. Providerissa pitää eksplisiittisesti castata toinen noista tyypeistä.

Copy link
Contributor

@Chrysalis-B Chrysalis-B Aug 23, 2024

Choose a reason for hiding this comment

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

en ehkä ihan saa kiinni mitä tarkotat mutta eikö siinä voisi tehdä jonkun typeguardin missä määritetään mitä contextille annetaan esim

  const contextValue = editable ? { editable, onChange, saveScreenshot } : { editable, saveScreenshot }
  return <GradingInstructionContext.Provider value={contextValue}>{children}</GradingInstructionContext.Provider>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pikaisella kokeilulla sain:

Types of property editable are incompatible.
Type boolean is not assignable to type false

En selvitellyt enempää.

Copy link
Contributor Author

@pejuam pejuam Aug 23, 2024

Choose a reason for hiding this comment

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

Selvitin kuitenkin: sillä on eroa, käyttääkö typeä vai interfacea.

Edit: Ei olekaan, tuo contextValue pitää tyypittää ekplisiittisesti tai sitten mä en vaan tajua jotain.

Copy link
Contributor

Choose a reason for hiding this comment

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

mä pullasin tän haaran ja sain sen jotenkin tyypitettyä, voidaan katsoa myös yhdessä.

@pejuam pejuam force-pushed the feature/editable-grading-instructions branch from 391d6a5 to c1e605c Compare August 23, 2024 08:06
@pejuam pejuam force-pushed the feature/editable-grading-instructions branch 7 times, most recently from 71842a2 to 982c3c6 Compare September 2, 2024 09:40
@pejuam pejuam force-pushed the feature/editable-grading-instructions branch from 0111eff to c91a4fe Compare September 6, 2024 07:32
pejuam and others added 14 commits September 6, 2024 10:33
* Use prosemirror instead of rich-text-editor

It is hard to extend rich-text-editor to have formatting and table support. Use prosemirror that has formatting and table suport and add math equation support for it later.

* Add support for line (paragraph) changes and removes
Fix path with localizations (language and exam type).
…, show button as active when mark is set and make button generic component
* Enable editable grading instructions with environmental variable

* Support e:formula with prosemirror

* Use common popup component

* v22.1.0-alpha.0
…#3980)

* Convert &nbsp; that use prosemirror uses into &#160; that xml expects

* Convert <br> that prosemirror and html uses into <br/> that xml expects

* Refactor test cases to use common function

* Convert <hr> that prosemirror and html uses into <hr/> that xml expects
It removes extra paragraphs from td elements
* Support spans with e-nowrap classes

* v22.1.3-alpha.0
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