2016-08-24 38 views
1

我有一個Angular2(RC5)和PrimeNG(測試13)應用程序,使用基於QuillJS編輯器PrimeNG編輯器組件(P-編輯)(V1.0.0中找到CSS文件-rc.2)。我的項目基於Angular 2 Seed項目。QuillJS編輯器加載正確,但無法粘貼

與精細的編輯器組件加載頁面,我能夠做一些基本的文本編輯。然而,當我嘗試粘貼一些文本編輯器,Chrome瀏覽器開發工具報告的一些404錯誤:

Dev tools errors

奇怪的是,如果我將鼠標懸停在clipboard.js:在開發工具122鏈接,地址顯示爲webpack:///./modules/clipboard.js 我不相信我使用的WebPack。

這裏是我的工具/配置/ project.config.ts文件

import { join } from 'path'; 

import { SeedConfig } from './seed.config'; 

/** 
* This class extends the basic seed configuration, allowing for project specific overrides. A few examples can be found 
* below. 
*/ 
export class ProjectConfig extends SeedConfig { 

    PROJECT_TASKS_DIR = join(process.cwd(), this.TOOLS_DIR, 'tasks', 'project'); 
    FONTS_DEST = `${this.APP_DEST}/fonts`; 
    FONTS_SRC = [ 
    'node_modules/font-awesome/fonts/**' 
    ]; 

    constructor() { 
    super(); 
    // this.APP_TITLE = 'Put name of your app here'; 

    /* Enable typeless compiler runs (faster) between typed compiler runs. */ 
    // this.TYPED_COMPILE_INTERVAL = 5; 

    // Add `NPM` third-party libraries to be injected/bundled. 
    this.NPM_DEPENDENCIES = [ 
     ...this.NPM_DEPENDENCIES, 
     // {src: 'jquery/dist/jquery.min.js', inject: 'libs'}, 
     { src: 'lodash/lodash.min.js', inject: 'libs' }, 
     { src: 'primeui/primeui-ng-all.min.js', inject: 'libs' }, 
     { src: 'quill/dist/quill.min.js', inject: 'libs' }, 

     { src: 'primeui/themes/delta/theme.css', inject: true }, // inject into css section 
     { src: 'font-awesome/css/font-awesome.min.css', inject: true }, // inject into css section 
     { src: 'primeui/primeui-ng-all.min.css', inject: true }, // inject into css section 
     { src: 'quill/dist/quill.snow.css', inject: true } 
    ]; 

    // Add `local` third-party libraries to be injected/bundled. 
    this.APP_ASSETS = [ 
     ...this.APP_ASSETS, 
     // {src: `${this.APP_SRC}/your-path-to-lib/libs/jquery-ui.js`, inject: true, vendor: false} 
     // {src: `${this.CSS_SRC}/path-to-lib/test-lib.css`, inject: true, vendor: false}, 
    ]; 

    /* Add to or override NPM module configurations: */ 
    // this.mergeObject(this.PLUGIN_CONFIGS['browser-sync'], { ghostMode: false }); 
    } 
} 

貌似奎爾(剪貼板)的依賴是沒有得到正確加載。我該如何解決?

回答

1

按照在上Angular2種子維基Add external dependency文章中的說明解決問題。

刪除從NPM_DEPENDENCIES羽毛筆項,並添加以下代碼ProjectConfig類的工具/配置/ project.config.ts構造

this.SYSTEM_CONFIG_DEV.paths['quill'] = 
    `${this.APP_BASE}node_modules/quill/quill`; 

this.SYSTEM_BUILDER_CONFIG.packages['quill'] = { 
    main: 'quill.js', 
    defaultExtension : 'js' 
};