Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
templateUrl: "./new-edit.component.html",
styleUrls: ["./new-edit.component.scss"],
})
export class AdminNewEditTermsComponent implements OnInit {
// TODO: Multiple language support
// TODO: Support external URLs
private shortcode: string;
public Editor = ClassicEditor;
public isLoading = true;
public isUpdating = false;
public takenShortcodes: string[];
public chosenLanguage: string = ISO6391.getAllCodes()[0];
public languages: {
[languageCode: string]: ILanguage;
} = {
"en": {
name: "",
text: "",
langName: "English",
url: "", // TODO: Calculate
isExternal: false,
externalUrl: "",
},
};
public isEditing = false;
public get chosenLanguageCodes(): string[] {
return Object.keys(this.languages);
});
} else
that.recognition.stop();
};
that.recognition.onend = function (e) {
if(!that.state.speechRecognitionDisabled){
console.warn('Recognition ended itself - stupid thing! Restarting ....', e);
that.recognition.start();
} else {
//TODO in StatusObjekt packen
}
};
let tmp = {};
ISO6391.getAllCodes().forEach((code) => {
tmp[''+code] = ISO6391.getName(code);
});
swal({
titleText: 'Speech recognition enabled',
html: '<p>Speech recognition is an experimental feature. If enabled, your voice will be automatically transcribed and displayed at all peers as a transcript.</p><p>Please select the language in which you will talk or disable the feature.</p>',
type: 'info',
input: 'select',
inputValue: that.recognition.lang,
inputOptions: tmp,
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Okay',
cancelButtonText: 'Disable',
allowOutsideClick: false,
_getOptions = () => ISO6391.getAllCodes().map(code => ({value: code, label: ISO6391.getName(code)}))
openChooseLanguageModal() {
let that = this;
let tmp = {};
ISO6391.getAllCodes().forEach((code) => {
if(this.languages.includes(''+code))
tmp[''+code] = '' + ISO6391.getName(code) + (((''+code) === that.deckLanguage) ? ' (default)' : '');
});
let dialog = {
titleText: 'Choose your preferred language',
html: '<p>Translations of this deck are available. You may choose one of these to view the slides in this langauge instead of the langauge the presenter chose to present (<strong>'+ISO6391.getName(this.deckLanguage)+'</strong>). You can change your decision at any time. Please keep in mind that not all slides might be translated to your chosen language.</p>',
type: 'info',
input: 'select',
inputValue: this.chosenLanguage,
inputOptions: tmp,
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Okay',
cancelButtonText: 'Cancel',
public get availableLanguages(): { name: string, code: string }[] {
return ISO6391.getAllCodes()
.filter(c => !this.chosenLanguageCodes.includes(c))
.map(c => {
return {code: c, name: ISO6391.getName(c)};
});
}
_getOptions = () => ISO6391.getAllCodes().map(code => ({value: code, label: ISO6391.getName(code)}))