如何在 TinyMCE for Apex 23.1 中添加新字体系列

问题描述 投票:0回答:1

我正在使用 Apex 23.1,我想在 Tiny MCE 中添加一个新的字体系列,并带有 url 文件引用! 这就是我所做的:

1- 在初始化 JavaScript 函数部分

tinymce.init({
 /* ... */
 font_formats:
   "Andale Mono=andale mono,times; Arial=arial,helvetica,sans-serif; Arial Black=arial black,avant garde; Book Antiqua=book antiqua,palatino; Comic Sans MS=comic sans ms,sans-serif; Courier New=courier new,courier; Georgia=georgia,palatino; Helvetica=helvetica; Impact=impact,chicago; Oswald=oswald; Symbol=symbol; Tahoma=tahoma,arial,helvetica,sans-serif; Terminal=terminal,monaco; Times New Roman=times new roman,times; Trebuchet MS=trebuchet ms,geneva; Verdana=verdana,geneva; Webdings=webdings; Wingdings=wingdings,zapf dingbats;peyda=peyda",
});

tinymce.init({
 /* ... */
 content_style:
   "@import url('#WORKSPACE_FILES#Peyda-Regular.ttf');",
});

2- 在页面的 inline css 部分

@font-face{
font-family:'Peyda';
src:url('#WORKSPACE_FILES#Peyda-Regular.ttf') format('truetype') !important;
}

但它不适用,甚至我在字体选择中也看不到我的新字体Peyda

javascript oracle-apex apex
1个回答
0
投票

正如我在这里问的,Louis Moreaux在那里回答了我:

对于 CSS 内联部分:

@font-face {
  font-family: "Peyda";
  src: url('#APP_FILES#Peyda-Regular.ttf') format('truetype');
}

以及初始化 JavaScript 函数 部分:

function(options) {
    options.editorOptions.font_css = ["#APP_FILES#Peyda-Regular.ttf"]; //Reference your custom fonts **note : here I should reference the css file not the ttf** 
    // Add the font family selector
    if ( Array.isArray( options.editorOptions.toolbar ) ) { 
    options.editorOptions.toolbar.push( { name: "fontfamily", items: [ "fontfamily" ] } ); 
    } else { 
    options.editorOptions.toolbar += " fontfamily"; 
    }

    options.editorOptions.font_family_formats = "Andale Mono=andale mono,times; Arial=arial,helvetica,sans-serif; Arial Black=arial black,avant garde; Book Antiqua=book antiqua,palatino; Comic Sans MS=comic sans ms,sans-serif; Courier New=courier new,courier; Georgia=georgia,palatino; Helvetica=helvetica; Impact=impact,chicago; Symbol=symbol; Tahoma=tahoma,arial,helvetica,sans-serif; Terminal=terminal,monaco; Times New Roman=times new roman,times; Trebuchet MS=trebuchet ms,geneva; Verdana=verdana,geneva; Webdings=webdings; Wingdings=wingdings,zapf dingbats; Peyda=Peyda" // Declare the fonts ( mine is peyda the last one)
    return options;
}

特别感谢Louis Moreaux

© www.soinside.com 2019 - 2024. All rights reserved.