-
Notifications
You must be signed in to change notification settings - Fork 6
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
base: master
Are you sure you want to change the base?
Conversation
088d488
to
391d6a5
Compare
export interface GradingInstructionProps { | ||
children?: React.ReactNode | ||
editable?: boolean | ||
onChange?: (answerHTML: string, displayNumber?: string) => void |
There was a problem hiding this comment.
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ä.
There was a problem hiding this comment.
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ä.
There was a problem hiding this comment.
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ä.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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) : () => {}) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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öä.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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ä.
There was a problem hiding this comment.
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>
There was a problem hiding this comment.
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ää.
There was a problem hiding this comment.
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 interface
a.
Edit: Ei olekaan, tuo contextValue pitää tyypittää ekplisiittisesti tai sitten mä en vaan tajua jotain.
There was a problem hiding this comment.
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ä.
391d6a5
to
c1e605c
Compare
packages/core/src/components/grading-instructions/GradingInstructions.tsx
Outdated
Show resolved
Hide resolved
71842a2
to
982c3c6
Compare
… needs to be passed when editable is true
This makes equations in richtext editor work properly.
0111eff
to
c91a4fe
Compare
* 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
It removes extra paragraphs from td elements
…rting with "feature/"
* Support spans with e-nowrap classes * v22.1.3-alpha.0
No description provided.