mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-14 02:26:20 +02:00
add option to specify and custom system font for editor. fixes #136
This commit is contained in:
@ -419,7 +419,10 @@
|
|||||||
<option value="Inconsolata">Inconsolata</option>
|
<option value="Inconsolata">Inconsolata</option>
|
||||||
<option value="Monoid">Monoid</option>
|
<option value="Monoid">Monoid</option>
|
||||||
<option value="FixedSys">FixedSys</option>
|
<option value="FixedSys">FixedSys</option>
|
||||||
|
<option disabled="disabled">----</option>
|
||||||
|
<option value="other">Other font from system</option>
|
||||||
</select>
|
</select>
|
||||||
|
<input id="customEditorFontInput" type="text" value="" placeholder="Custom font name here" data-setting="editorCustomFont" d-change="updateSetting">
|
||||||
</label>
|
</label>
|
||||||
<label class="line">
|
<label class="line">
|
||||||
Font Size <input type="number" value="16" data-setting="fontSize" d-change="updateSetting"> px
|
Font Size <input type="number" value="16" data-setting="fontSize" d-change="updateSetting"> px
|
||||||
|
@ -5,7 +5,8 @@ addLibraryModal, addLibraryModal, notificationsBtn, notificationsModal, notifica
|
|||||||
notificationsModal, notificationsBtn, codepenBtn, saveHtmlBtn, saveBtn, settingsBtn,
|
notificationsModal, notificationsBtn, codepenBtn, saveHtmlBtn, saveBtn, settingsBtn,
|
||||||
onboardModal, settingsModal, notificationsBtn, onboardShowInTabOptionBtn, editorThemeLinkTag,
|
onboardModal, settingsModal, notificationsBtn, onboardShowInTabOptionBtn, editorThemeLinkTag,
|
||||||
onboardDontShowInTabOptionBtn, TextareaAutoComplete, savedItemCountEl, indentationSizeValueEl,
|
onboardDontShowInTabOptionBtn, TextareaAutoComplete, savedItemCountEl, indentationSizeValueEl,
|
||||||
runBtn, searchInput, consoleEl, consoleLogEl, logCountEl, fontStyleTag, fontStyleTemplate
|
runBtn, searchInput, consoleEl, consoleLogEl, logCountEl, fontStyleTag, fontStyleTemplate,
|
||||||
|
customEditorFontInput
|
||||||
*/
|
*/
|
||||||
/* eslint-disable no-extra-semi */
|
/* eslint-disable no-extra-semi */
|
||||||
(function(alertsService) {
|
(function(alertsService) {
|
||||||
@ -1582,6 +1583,7 @@ runBtn, searchInput, consoleEl, consoleLogEl, logCountEl, fontStyleTag, fontStyl
|
|||||||
$('[data-setting=refreshOnResize]').checked = prefs.refreshOnResize;
|
$('[data-setting=refreshOnResize]').checked = prefs.refreshOnResize;
|
||||||
$('[data-setting=autoPreview]').checked = prefs.autoPreview;
|
$('[data-setting=autoPreview]').checked = prefs.autoPreview;
|
||||||
$('[data-setting=editorFont]').value = prefs.editorFont;
|
$('[data-setting=editorFont]').value = prefs.editorFont;
|
||||||
|
$('[data-setting=editorCustomFont]').value = prefs.editorCustomFont;
|
||||||
$('[data-setting=autoSave]').checked = prefs.autoSave;
|
$('[data-setting=autoSave]').checked = prefs.autoSave;
|
||||||
$('[data-setting=autoComplete]').checked = prefs.autoComplete;
|
$('[data-setting=autoComplete]').checked = prefs.autoComplete;
|
||||||
}
|
}
|
||||||
@ -1620,8 +1622,13 @@ runBtn, searchInput, consoleEl, consoleLogEl, logCountEl, fontStyleTag, fontStyl
|
|||||||
'/lib/codemirror/theme/' + prefs.editorTheme + '.css';
|
'/lib/codemirror/theme/' + prefs.editorTheme + '.css';
|
||||||
fontStyleTag.textContent = fontStyleTemplate.textContent.replace(
|
fontStyleTag.textContent = fontStyleTemplate.textContent.replace(
|
||||||
/fontname/g,
|
/fontname/g,
|
||||||
prefs.editorFont || 'FiraCode'
|
(prefs.editorFont === 'other'
|
||||||
|
? prefs.editorCustomFont
|
||||||
|
: prefs.editorFont) || 'FiraCode'
|
||||||
);
|
);
|
||||||
|
customEditorFontInput.classList[
|
||||||
|
prefs.editorFont === 'other' ? 'remove' : 'add'
|
||||||
|
]('hide');
|
||||||
|
|
||||||
['html', 'js', 'css'].forEach(type => {
|
['html', 'js', 'css'].forEach(type => {
|
||||||
scope.cm[type].setOption(
|
scope.cm[type].setOption(
|
||||||
@ -2143,6 +2150,7 @@ runBtn, searchInput, consoleEl, consoleLogEl, logCountEl, fontStyleTag, fontStyl
|
|||||||
refreshOnResize: false,
|
refreshOnResize: false,
|
||||||
autoPreview: true,
|
autoPreview: true,
|
||||||
editorFont: 'FiraCode',
|
editorFont: 'FiraCode',
|
||||||
|
editorCustomFont: '',
|
||||||
autoSave: true,
|
autoSave: true,
|
||||||
autoComplete: true
|
autoComplete: true
|
||||||
},
|
},
|
||||||
@ -2177,6 +2185,7 @@ runBtn, searchInput, consoleEl, consoleLogEl, logCountEl, fontStyleTag, fontStyl
|
|||||||
prefs.refreshOnResize = result.refreshOnResize;
|
prefs.refreshOnResize = result.refreshOnResize;
|
||||||
prefs.autoPreview = result.autoPreview;
|
prefs.autoPreview = result.autoPreview;
|
||||||
prefs.editorFont = result.editorFont;
|
prefs.editorFont = result.editorFont;
|
||||||
|
prefs.editorCustomFont = result.editorCustomFont;
|
||||||
prefs.autoSave = result.autoSave;
|
prefs.autoSave = result.autoSave;
|
||||||
prefs.autoComplete = result.autoComplete;
|
prefs.autoComplete = result.autoComplete;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user