mirror of
				https://github.com/Alamantus/Lexiconga.git
				synced 2025-11-04 10:17:01 +01:00 
			
		
		
		
	Prepare dictionary structure for changes (breaking changes)
This commit is contained in:
		
							parent
							
								
									464cdc8425
								
							
						
					
					
						commit
						f366b001b3
					
				
					 2 changed files with 28 additions and 13 deletions
				
			
		| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
import { getTimestampInSeconds } from "./helpers";
 | 
			
		||||
 | 
			
		||||
export const MIGRATE_VERSION = '2.0.0';
 | 
			
		||||
export const MIGRATE_VERSION = '2.0.1';
 | 
			
		||||
export const DEFAULT_DICTIONARY = {
 | 
			
		||||
  name: 'New',
 | 
			
		||||
  specification: 'Dictionary',
 | 
			
		||||
| 
						 | 
				
			
			@ -12,25 +12,29 @@ export const DEFAULT_DICTIONARY = {
 | 
			
		|||
      consonants: [],
 | 
			
		||||
      vowels: [],
 | 
			
		||||
      blends: [],
 | 
			
		||||
      phonotactics: {
 | 
			
		||||
        onset: [],
 | 
			
		||||
        nucleus: [],
 | 
			
		||||
        coda: [],
 | 
			
		||||
        exceptions: '',
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
    phonotactics: {
 | 
			
		||||
      onset: [],
 | 
			
		||||
      nucleus: [],
 | 
			
		||||
      coda: [],
 | 
			
		||||
      notes: '',
 | 
			
		||||
    },
 | 
			
		||||
    orthography: {
 | 
			
		||||
      translations: [],
 | 
			
		||||
      notes: '',
 | 
			
		||||
    },
 | 
			
		||||
    grammar: {
 | 
			
		||||
      notes: '',
 | 
			
		||||
    },
 | 
			
		||||
    // custom: [
 | 
			
		||||
    //   // {
 | 
			
		||||
    //   //   name: 'Example Tab',
 | 
			
		||||
    //   //   content: `This is an _example_ tab to show how **tabs** work with [Markdown](${ MARKDOWN_LINK })!`,
 | 
			
		||||
    //   // }
 | 
			
		||||
    // ],
 | 
			
		||||
    custom: {
 | 
			
		||||
      css: '',
 | 
			
		||||
      // tabs: [
 | 
			
		||||
        // {
 | 
			
		||||
        //   name: 'Example Tab',
 | 
			
		||||
        //   content: `This is an _example_ tab to show how **tabs** work with [Markdown](${ MARKDOWN_LINK })!`,
 | 
			
		||||
        // }
 | 
			
		||||
      // ],
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  words: [
 | 
			
		||||
    /* {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -103,6 +103,17 @@ export function migrateDictionary() {
 | 
			
		|||
    migrated = true;
 | 
			
		||||
  } else if (window.currentDictionary.version !== MIGRATE_VERSION) {
 | 
			
		||||
    switch (window.currentDictionary.version) {
 | 
			
		||||
      case '2.0.1': {
 | 
			
		||||
        window.currentDictionary.details.phonotactics = Object.assign({}, window.currentDictionary.details.phonology.phonotactics);
 | 
			
		||||
        delete window.currentDictionary.details.phonology.phonotactics;
 | 
			
		||||
        window.currentDictionary.details.phonotactics.notes = window.currentDictionary.details.phonotactics.exceptions;
 | 
			
		||||
        delete window.currentDictionary.details.phonotactics.exceptions;
 | 
			
		||||
        // Add window.currentDictionary.details.orthography.translations = [];
 | 
			
		||||
        // Add window.currentDictionary.custom.css = '';
 | 
			
		||||
        window.currentDictionary = Object.assign({}, DEFAULT_DICTIONARY, window.currentDictionary);
 | 
			
		||||
        migrated = true;
 | 
			
		||||
        break;
 | 
			
		||||
      }
 | 
			
		||||
      default: console.error('Unknown version'); break;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue