File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -429,12 +429,17 @@ async function recompactDocWithAllContexts(doc) {
429429async function importCodemeta ( ) {
430430 var inputForm = document . querySelector ( '#inputForm' ) ;
431431 var doc = parseAndValidateCodemeta ( false ) ;
432+ // parseAndValidateCodemeta() may set an error message.
433+ // resetForm() below runs generateCodemeta() which would clear the error message;
434+ // preserve the error message so it is there after import.
435+ const validationError = ( document . getElementById ( 'errorMessage' ) || { } ) . textContent || '' ;
432436
433437 // Re-compact document with all contexts
434438 // to allow importing property from any context
435439 doc = await recompactDocWithAllContexts ( doc ) ;
436440
437441 resetForm ( ) ;
442+ if ( validationError ) setError ( validationError ) ;
438443
439444 if ( doc [ 'license' ] !== undefined ) {
440445 if ( typeof doc [ 'license' ] === 'string' ) {
Original file line number Diff line number Diff line change @@ -232,10 +232,8 @@ function removePersons(prefix) {
232232 const container = document . getElementById ( `${ prefix } _list` ) ;
233233 if ( ! container ) return ;
234234
235- const persons = Array . from ( container . querySelectorAll ( '.person' ) ) ;
236- persons . forEach ( p => p . remove ( ) ) ;
237-
238- renumberPersons ( prefix ) ;
235+ container . innerHTML = '' ;
236+ setNbPersons ( prefix , 0 ) ;
239237 generateCodemeta ( ) ;
240238}
241239
@@ -273,6 +271,7 @@ function addRole(personPrefix) {
273271
274272function removeRole ( personPrefix , roleIndex ) {
275273 document . getElementById ( `${ personPrefix } _role_${ roleIndex } ` ) . remove ( ) ;
274+ generateCodemeta ( ) ;
276275}
277276
278277function resetForm ( ) {
You can’t perform that action at this time.
0 commit comments