小编118*_*218的帖子

如何为 Angular“@ckeditor/ckeditor5-angular”添加插件到 CKEditor?

我按照本指南为 Angular 安装了 CKEditor:https : //ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/frameworks/angular.html

我将 CKEditorModule 导入我的模块并将其添加到我的导入中。

import { CKEditorModule } from "@ckeditor/ckeditor5-angular";

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    CKEditorModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
Run Code Online (Sandbox Code Playgroud)

在我的组件中,我添加了 ClassicEditor 构建并将其分配给公共属性。

import * as ClassicEditor from '@ckeditor/ckeditor5-build-classic';

export class AppComponent {
  title = 'AngularCkeditor';
  public Editor = ClassicEditor;
}
Run Code Online (Sandbox Code Playgroud)

最后我在我的 html 模板中使用了 ckeditor 标签:

<ckeditor [editor]="Editor" data="<p>Hello, world!</p>"></ckeditor>
Run Code Online (Sandbox Code Playgroud)

它工作得很好!

现在我想向其中添加一些插件,但没有解释如何实现。

所以我遵循了安装插件的默认指南:https : //ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/installing-plugins.html

例如,我尝试安装 Alignment 插件:

npm install --save @ckeditor/ckeditor5-alignment

然后我将插件导入我的组件并尝试加载它。

import Alignment from '@ckeditor/ckeditor5-alignment/src/alignment'; …
Run Code Online (Sandbox Code Playgroud)

ckeditor angular

10
推荐指数
1
解决办法
9770
查看次数

Android:我如何知道textView(我的页面)中可以容纳多少文本?

我想创建一个文本阅读器,它将剪切文本并将其放在TextView(代表我的页面)和一个接一个.它们包含在ViewFlipper(代表我的整个文本)中,它允许我翻页.

通过利弊我不能聪明地削减我的文字.现在我将每个TextView限制为多个字符,但它非常不稳定.事实上,有些字母占用的空间比其他字母多.我们不能使用这种方法.

我们如何才能知道TextView中输入的文本数量是多少?

我试图手动找到我的View的最大大小.我援引:

float test = view.getPaint().measureText(myString);
Run Code Online (Sandbox Code Playgroud)

它运作良好.当我输入480个字母(0和1)时,我得到14,400,我的文字完全在屏幕内.附:

1  -> 12.0
0  -> 12.0
é  -> 11.0
\n -> 13.0
\r ->  7.0
Run Code Online (Sandbox Code Playgroud)

总计填写页面 - > 14400

问题是换行和回车导致问题.

如果我的字符串中只有字母或数字,那么好:如果我们尊重最大尺寸14,400,屏幕上会显示所有内容.没问题!

通过利弊,如果换行或回车,它不起作用.即使我们尊重14400的限制,上面的文字并没有完全显示.

这是因为"MeasureText"方法;"仅为换行符返回13.但奇怪的是,换行符应该至少包含480以使其保持一致.

出版商如何将电子书(Moon Reader,+ Aldiko)的文字格式化得如此之好?每个页面都有相同的高度,文本结尾在同一个地方..

android text textview

9
推荐指数
1
解决办法
2770
查看次数

如何将配置文件 (openapitools.json) 与 @openapitools/openapi-generator-cli 一起使用?

我使用@openapitools/openapi-generator-cli (v2.1.7) 在客户端生成 API 库。

它工作得很好,除了我无法按照我的意愿格式化生成的代码。

我刚刚注意到有一个新选项可以配置示例中提到的空格("spaces": 2):

{
  "$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json",
  "spaces": 2,
  "generator-cli": {
    "version": "4.3.1",
    "storageDir": "~/my/custom/storage/dir", // optional
    "generators": { // optional
      "v2.0": { // any name you like (just printed to the console log) 
        "generatorName": "typescript-angular",
        "output": "#{cwd}/output/v2.0/#{ext}/#{name}",
        "glob": "examples/v2.0/{json,yaml}/*.{json,yaml}",
        "additionalProperties": {
          "ngVersion": "6.1.7",
          "npmName": "restClient",
          "supportsES6": "true",
          "npmVersion": "6.9.0",
          "withInterfaces": true
        }
      },
      "v3.0": { // any name you like (just printed to the console log) 
        "generatorName": "typescript-fetch",
        "output": "#{cwd}/output/v3.0/#{ext}/#{name}",
        "glob": "examples/v3.0/petstore.{json,yaml}" …
Run Code Online (Sandbox Code Playgroud)

npm angular openapi-generator

7
推荐指数
1
解决办法
2163
查看次数

为什么我只能在使用之前转储()它时才能到达我的日期对象?

为什么我dump()在使用它之前只能到达我的日期对象?

这是我的功能:

public function checkSubscriptionEndDate($user){

    $subscriptionEndDate = $user->getSubscriptionEndDate();

    dump($subscriptionEndDate);

    if($subscriptionEndDate==null){
        $subscriptionEndDateMessage = $this->get('translator')->trans('subscriptionEndDateMessage');
        $subscriptionStatus = "error";
    }else{

        $subscriptionEndDateDate = $subscriptionEndDate->date;
        // CHECK IF SUBSCRIPTION END DATE IS BEFORE NOW
        if (date('now') < $subscriptionEndDateDate) {
            dump('before');
            $subscriptionStatus = "success";
            $subscriptionEndDateMessage = $this->get('translator')->trans('subscriptionStatusSuccess').' '.date('d/m/Y',strtotime($subscriptionEndDateDate));
        }else{
            dump('after');
            $subscriptionStatus = "error";
            $subscriptionEndDateMessage = $this->get('translator')->trans('subscriptionStatusError').' '.date('d/m/Y',strtotime($subscriptionEndDateDate));
        }   
    }

    return array(
        'subscriptionEndDateMessage' => $subscriptionEndDateMessage,
        'subscriptionStatus' => $subscriptionStatus
    );

    return $subscriptionEndDateMessage;

}
Run Code Online (Sandbox Code Playgroud)

当我这样做时,页面按预期加载,没有问题.但如果我删除这一行:

dump($subscriptionEndDate);

我无法再加载$subscriptionEndDate->date此错误页面中所示:

在此输入图像描述

php datetime var-dump symfony

2
推荐指数
1
解决办法
49
查看次数

错误类型错误:无法读取未定义的属性“属性”

我想将对象添加到对象数组中。

所以我创建了一个变量并初始化它

articles: {}[] = [];
Run Code Online (Sandbox Code Playgroud)

然后,我尝试添加来自服务的对象

loadArticles(editionId) {
  this.articlesService.articlesGetArticlesForEdition(editionId).subscribe(articles => {
    console.log(articles);
    articles.forEach(function (article, i) {
      console.log(article);
      this.articles.push(article);
    });
    console.log(this.articles);
  });
}
Run Code Online (Sandbox Code Playgroud)

当我尝试将对象推送到我的数组时会出现问题: this.articles.push(article);

当我这样做时,我收到一个错误:

core.js:15723 错误类型错误:无法读取未定义的属性“文章”

Web 服务返回的 JSON,看起来像这样

[
    {
        "category": "Editorial",
        "categoryFR": "Editorial",
        "shortCategory": "Editorial",
        "shortCategoryFR": "Editorial",
        "title": "Let’s go digital!",
        "titleFR": "Let’s go digital!",
        "chapo": "",
        "chapoFR": "",
        "bodyStyle": false,
        "body": "",
        "bodyFR": null,
        "body2": null,
        "body2FR": null,
        "mainVideo": null,
        "mainVideoCaption": null,
        "mainVideoCredits": null,
        "readingTime": "2",
        "edition": {
            "title": "Issue 1 - December 2018",
            "slogan": …
Run Code Online (Sandbox Code Playgroud)

arrays typescript angular

2
推荐指数
1
解决办法
8222
查看次数

Synology - Cron 作业

我正在尝试使 cron 作业或任务调度程序工作,但我无法弄清楚为什么我的脚本没有被考虑在内。

我试图简单地归档一个文件夹:

tar -cvf /volume1/NetBackup/Backups/Monday.tgz /volume1/NetBackup/Backups/ns3268116.ovh.net/
Run Code Online (Sandbox Code Playgroud)

每次脚本开始工作但无法完成工作。无论是使用任务调度程序还是 crontab,都会在文件夹 /volume1/NetBackup/Backups/ 中创建一个文件 Monday.tgz,但该文件只有 1024 字节。

linux cron synology

1
推荐指数
1
解决办法
5219
查看次数

HTML/CSS 如何用另一个(液体布局)包装图像?

对于作品集,我需要用计算机图像包装所有图像以进行演示。我将使用类似这个例子的东西来包装图像:

在此处输入图片说明

图像必须具有流体尺寸(高度和宽度百分比),因此包装纸也......

任何人都知道如何实现这一目标?

有没有办法做到跨浏览器的方式?

html css liquid-layout fluid-layout

0
推荐指数
1
解决办法
897
查看次数

如何确保一个 I/O 流的关闭?

考虑这个函数:

import java.io.IOException;
import java.io.Reader;

class StreamPrinter {

    void print(Reader reader) throws IOException {
        int code = reader.read();
        while (code != -1) {
            System.out.print((char) code);
            code = reader.read();
        }

        reader.close();
    }

}
Run Code Online (Sandbox Code Playgroud)

如何在异常和错误的情况下关闭流?

java io

0
推荐指数
1
解决办法
1796
查看次数