File previewing method and device based on previewing plug-in, equipment and storage medium

By downloading and registering preview plug-ins in the target project, the operation process of multi-file preview is simplified, the complexity of traditional methods is solved, the preview efficiency and adaptability is improved, and it is suitable for modern office and cloud storage services.

CN118964307APending Publication Date: 2024-11-15创优数字科技(广东)有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411070563.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-06
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

The traditional way of implementing the independent preview function of multiple files is cumbersome and complex, which affects the preview efficiency and causes inconvenience to staff.

Method used

By downloading the pre-created preview plug-in in the target project, calling the plug-in to determine the main file, and implanting preview instructions in the main file for global registration, responding to the user's file preview click command, and using the preview instructions to create and display preview elements.

Benefits of technology

Simplifies the operation process, avoids the repetitive process of introducing third-party libraries or components every time the preview is achieved, improves preview efficiency, adapts to different systems and projects, reduces development and maintenance costs, and improves staff's work efficiency and user experience. .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118964307A_ABST
    Figure CN118964307A_ABST
Patent Text Reader

Abstract

The invention discloses a file preview method and device based on a preview plug-in, equipment and a storage medium. The method comprises the following steps: downloading a pre-created preview plug-in in a target project; calling the preview plug-in to determine a main file in the target project; implanting a preview instruction in the preview plug-in into the main file, and performing global registration; determining a to-be-previewed file corresponding to a click instruction in response to the click instruction for previewing the file initiated by the user in the target item; creating each preview element corresponding to the to-be-previewed file by utilizing the preview instruction; and previewing the to-be-previewed file by using each preview element. Compared with the prior art, the scheme does not need to introduce a component or a third-party library required by preview during each preview, can utilize the preview instruction to create the preview element when responding to the click instruction of the user, and utilizes the preview element to preview the to-be-previewed file, so that the whole process is simple and efficient, the preview efficiency is improved, and the user experience is improved. And the work of workers is facilitated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of file preview, and in particular to a file preview method, device, equipment and storage medium based on a preview plug-in. Background Art

[0002] File preview refers to the function of providing a quick preview or overview of the file content, format and layout through specific software or system before viewing or sharing the file. With the rapid development of information technology and the popularization of Internet applications, file preview technology has become an indispensable part of modern office, cloud storage services and other fields. In various fields, the types of files are very complex and numerous. When users are working, especially when comparing files and data, they need to open multiple files at the same time.

[0003] The traditional way to achieve the independent preview function of multiple files is to introduce third-party libraries or packaged components. When each file needs to be previewed, it is necessary to introduce the third-party library or packaged component separately, that is, the introduction process will be repeated many times. This method is very cumbersome and complicated, which greatly affects the preview efficiency and brings inconvenience to the staff. Summary of the invention

[0004] In view of this, the present application provides a file preview method, device, equipment and storage medium based on a preview plug-in, which is used to solve the problem that the traditional way of implementing the independent preview function of multiple files is cumbersome and complicated, which greatly affects the preview efficiency and brings inconvenience to the staff.

[0005] To achieve the above objectives, the proposed solution is as follows:

[0006] In a first aspect, a file preview method based on a preview plug-in comprises:

[0007] Download the pre-created preview plugin in the target project;

[0008] Call the preview plug-in to determine the main file in the target project;

[0009] Embed the preview instruction in the preview plug-in in the main file and register it globally;

[0010] In response to a click instruction initiated by a user to preview a file in the target project, determining a file to be previewed corresponding to the click instruction;

[0011] Using the preview instruction, create each preview element corresponding to the file to be previewed;

[0012] The file to be previewed is previewed using each of the preview elements.

[0013] Preferably, the method for creating the preview plug-in includes:

[0014] Select a plug-in development tool and create a blank directory using the plug-in development tool;

[0015] Use the command prompt to run the template generation command in the blank directory to generate a plug-in project template;

[0016] Performing basic configuration on the plug-in project template to obtain a first template;

[0017] Create a custom instruction, and configure a preview function in the custom instruction to obtain a preview instruction;

[0018] The preview instruction is implanted into the first template to obtain a preview plug-in.

[0019] Preferably, performing basic configuration on the plug-in project template to obtain a first template includes:

[0020] Generate a plug-in project file in the plug-in project template and select JavaScript as the programming language;

[0021] Naming the plug-in project file and defining a version number to obtain a configuration file;

[0022] Metadata is configured in the configuration file to obtain a first template.

[0023] Preferably, the preview instruction embedded in the preview plug-in in the main file includes:

[0024] Adapting the preview instruction in the preview plug-in;

[0025] The adapted preview instructions are embedded in the master file.

[0026] Preferably, adapting the preview instruction in the preview plug-in includes:

[0027] Identify a specific file in the target project;

[0028] Get the file name of the specific file;

[0029] Calling the preview plug-in and determining the project type of the target project based on the file name;

[0030] The preview instructions in the preview plug-in are adapted according to the project type.

[0031] Preferably, configuring a preview function in the custom instruction to obtain a preview instruction includes:

[0032] Configure a picture preview function, a document preview function, a video preview function, an audio preview function and a comprehensive file preview function in the custom instruction;

[0033] The configured custom instructions are encapsulated to obtain preview instructions.

[0034] Preferably, the step of creating each preview element corresponding to the file to be previewed by using the preview instruction includes:

[0035] Determine each file element under the file to be previewed;

[0036] Binding the preview instruction with each of the file elements to obtain each binding element;

[0037] A corresponding independent element is created based on each of the binding elements as each preview element.

[0038] In a second aspect, a file preview device based on a preview plug-in includes:

[0039] Preview plugin download module, used to download pre-created preview plugins in the target project;

[0040] A target project master file determination module, used for calling the preview plug-in to determine the master file in the target project;

[0041] A preview instruction implantation and global registration module, used for implanting the preview instruction in the preview plug-in into the main file and performing global registration;

[0042] A module for determining files to be previewed, configured to respond to a click instruction initiated by a user to preview a file in the target project and determine a file to be previewed corresponding to the click instruction;

[0043] A preview element creation module, used to create each preview element corresponding to the file to be previewed using the preview instruction;

[0044] The preview module is used to preview the file to be previewed by using each of the preview elements.

[0045] In a third aspect, a file preview device based on a preview plug-in includes a memory and a processor;

[0046] The memory is used to store programs;

[0047] The processor is used to execute the program to implement each step of the file preview method based on the preview plug-in as described in any one of the first aspects.

[0048] In a fourth aspect, a storage medium stores a computer program thereon, and when the computer program is executed by a processor, the steps of file preview based on the preview plug-in as described in any one of the first aspects are implemented.

[0049] It can be seen from the above technical scheme that the present application downloads a pre-created preview plug-in in the target project; calls the preview plug-in to determine the main file in the target project; implants the preview instruction in the preview plug-in in the main file and performs global registration; responds to the click instruction initiated by the user in the target project to preview the file, determines the file to be previewed corresponding to the click instruction; uses the preview instruction to create each preview element corresponding to the file to be previewed; and uses each preview element to preview the file to be previewed. This scheme pre-creates a preview plug-in. Before performing a file preview, first download the preview plug-in in the target project, call the preview plug-in to determine the main file, and the preview plug-in contains the preview instruction. Therefore, the preview instruction is implanted in the main file and globally registered to ensure that the entire target project can execute the preview instruction, which greatly saves the operation process. It is not necessary to introduce the preview required components or third-party libraries every time a preview is performed as in the prior art. Therefore, when responding to the user's click instruction, the preview instruction can be used to create a preview element, and the preview element can be used to preview the preview file. The whole process is simple and efficient, which improves the preview efficiency and is very beneficial to the work of the staff. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0051] Figure 1 An optional flow chart of a file preview method based on a preview plug-in provided in an embodiment of the present application;

[0052] Figure 2 A schematic diagram of the configuration and packaging process of the preview instruction provided in an embodiment of the present application;

[0053] Figure 3 A schematic diagram of an online multi-file preview scenario provided in an embodiment of the present application;

[0054] Figure 4 A schematic diagram of the structure of a file preview device based on a preview plug-in provided in an embodiment of the present application;

[0055] Figure 5A schematic diagram of the structure of a file preview device based on a preview plug-in provided in an embodiment of the present application. DETAILED DESCRIPTION

[0056] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0057] File preview refers to the function of providing a quick preview or overview of the file content, format and layout through specific software or system before viewing or sharing the file. With the rapid development of information technology and the popularization of Internet applications, file preview technology has become an indispensable part of modern office, cloud storage services and other fields. In various fields, the types of files are very complex and numerous. Users need to open multiple files at the same time when working, especially when performing file comparison and data comparison. For example, in the e-commerce field, merchants need to go through multiple nodes of review in the entire process from new product research and development to production and listing, which will include a large number of files and sample information charts. Therefore, if the preview function is not convenient, it will make the product data difficult to maintain, and the staff will easily get lost in many files. Therefore, the independent preview function of multiple files is crucial, and generally focuses on the online preview function. The traditional way to implement the independent preview function of multiple files is to introduce third-party libraries or packaged components. When each file needs to be previewed, it is necessary to introduce the third-party library or packaged component separately, that is, the introduction process will be repeated many times. This method is very cumbersome and complicated, which greatly affects the preview efficiency, brings inconvenience to the staff, and increases the maintenance burden of development. In addition, different systems that can implement previews have different preview implementation methods. If the system is replaced, the complexity will also increase. In addition, the scalability is also relatively poor, and it is difficult to meet the increasingly complex business requirements.

[0058] In order to solve the defects of the above-mentioned prior art, an embodiment of the present invention provides a file preview method based on a preview plug-in, which can be applied to various computer terminals or smart terminals, and its execution subject can be a processor or server of the computer terminal or smart terminal. The method flow chart of the method is as follows: Figure 1 As shown, specifically including:

[0059] S1: Download the pre-created preview plugin in the target project.

[0060] The target project in this application refers to project files, project materials, documents, etc. that require file preview. It can also be considered as project files that require downloading preview plug-ins, or file viewing systems, file preview software, etc.

[0061] Preview plugins are pre-built and can be plugged into any project / system / software for use, regardless of version or form.

[0062] This application can choose native JavaScript as the basis to build a universal preview plug-in.

[0063] S2: Calling the preview plug-in to determine the main file in the target project.

[0064] The main file of a project usually plays an important role in the project. As the entry point, it is responsible for starting the program and calling other necessary components. It can also store core data and control the project process.

[0065] Therefore, if the present application is to implement the preview function of the entire target project with a preview plug-in, it is necessary to first determine the main file in the target project and specifically call the downloaded preview plug-in to determine it.

[0066] It can be considered that the main file generally has a certain mark, and the preview plug-in can identify this mark to determine which file is the main file of the target project; in addition, the target project will first execute the main file when it is started, so the preview plug-in can be called to identify the file to be executed first.

[0067] S3: embed the preview instruction in the preview plug-in into the main file and register it globally.

[0068] Global registration means using the preview plug-in anywhere in the target project without having to implant it separately in each component that uses it. So it can be understood that by configuring / implanting / inserting any plug-in, component, etc. in the main file of the project and registering it globally, the functions that the plug-in / component can achieve can be achieved globally.

[0069] In one example, after the preview plug-in is called to determine the main file (main.js), the main file is edited, including adding a global registration code in the main file.

[0070] S4: In response to a click instruction for previewing a file initiated by the user in the target project, determining a file to be previewed corresponding to the click instruction.

[0071] After the above steps are completed, if the user initiates a request instruction for file preview in the target project, specifically, the user clicks on a file in the target project for preview, the click position is first determined, that is, the file to be previewed is determined.

[0072] The file to be previewed is not limited to the file format, and may be a document, picture, audio or video, etc.

[0073] S5: Using the preview instruction, create various preview elements corresponding to the file to be previewed.

[0074] Preview elements refer to various HTML elements required for previewing files, such as img / video / iframe, etc. In addition, various auxiliary functions can be added to these preview elements.

[0075] The preview command is used to create the file, and each preview element corresponds to the file to be previewed.

[0076] Specifically, the preview instruction is executed, and after execution, one or more preview elements corresponding to the file to be previewed are automatically created.

[0077] S6: Previewing the file to be previewed using each of the preview elements.

[0078] The preview command can identify the file content of the file to be previewed, and establish a preview window based on the preview element to achieve the preview.

[0079] It can be seen from the above technical scheme that the present application downloads a pre-created preview plug-in in the target project; calls the preview plug-in to determine the main file in the target project; implants the preview instruction in the preview plug-in in the main file and performs global registration; responds to the click instruction initiated by the user in the target project to preview the file, determines the file to be previewed corresponding to the click instruction; uses the preview instruction to create each preview element corresponding to the file to be previewed; and uses each preview element to preview the file to be previewed. This scheme pre-creates a preview plug-in. Before performing a file preview, first download the preview plug-in in the target project, call the preview plug-in to determine the main file, and the preview plug-in contains the preview instruction. Therefore, the preview instruction is implanted in the main file and globally registered to ensure that the entire target project can execute the preview instruction, which greatly saves the operation process. It is not necessary to introduce the preview required components or third-party libraries every time a preview is performed as in the prior art. Therefore, when responding to the user's click instruction, the preview instruction can be used to create a preview element, and the preview element can be used to preview the preview file. The whole process is simple and efficient, which improves the preview efficiency and is very beneficial to the work of the staff.

[0080] The preview plug-in created by this application is not only a lightweight plug-in, but also has strong compatibility. While realizing the file preview function, it can also respond quickly and be compatible with different systems / software / projects. It is not limited by the project technology stack, can improve the unity and stability of the target project, will not affect the structure and style of the original code, does not need to modify a large amount of code, can be quickly deployed and used globally, reduces development and maintenance costs, and meets the needs of different systems / software / projects for file management. The preview function is realized by this preview plug-in, and multiple files can be previewed at the same time, and each preview window runs independently. Users or staff can easily drag and drop files for comparison and review, which greatly improves work efficiency and operational convenience, and improves user experience.

[0081] In the method provided in the embodiment of the present invention, the process of the method for creating a preview plug-in is specifically described as follows:

[0082] Select a plug-in development tool and create a blank directory using the plug-in development tool;

[0083] Use the command prompt to run the template generation command in the blank directory to generate a plug-in project template;

[0084] Performing basic configuration on the plug-in project template to obtain a first template;

[0085] Create a custom instruction, and configure a preview function in the custom instruction to obtain a preview instruction;

[0086] The preview instruction is implanted into the first template to obtain a preview plug-in.

[0087] Specifically, in an example, for example, if the target project is running in the VS Code editor, a preview plug-in can be created. After the build is complete, it can be uploaded to the VS Code application market for other users to download and use. First, install the plug-in development tool Yeoman provided by the VS Code official website, create a blank directory, and use the command prompt to run the command yo code in the blank directory to quickly generate a new plug-in project template, and perform basic configuration for the plug-in project template, which can be configured according to needs or special requirements. Next, you need to create a preview instruction. You can first create a custom instruction and configure all preview functions in the custom instruction, which can realize all current preview requirements. After the configuration is complete, you get the preview instruction v-preView, and then implant the preview instruction into the first template to finally get the preview plug-in.

[0088] The process of performing basic configuration on the plug-in project template to obtain the first template may specifically include:

[0089] Generate a plug-in project file in the plug-in project template and select JavaScript as the programming language;

[0090] Naming the plug-in project file and defining a version number to obtain a configuration file;

[0091] Metadata is configured in the configuration file to obtain a first template.

[0092] Specifically, the plug-in project file can be a package.json file, which is a core file in the Node.js project and is located in the root directory of the project. It can provide metadata for the project, and it is based on the JSON format and can contain the name, version, description, keywords, author information, dependency list (including development dependencies and production dependencies), scripts, etc. of the target project. Therefore, JavaScript can be selected as the programming language, and the file can be named, and basic information such as the version number can be defined to obtain a configuration file, and metadata can be configured in the configuration file to obtain the first template. The metadata includes registration commands, activation time, etc.

[0093] Furthermore, configuring a preview function in the custom instruction to obtain a preview instruction may specifically include:

[0094] Configure a picture preview function, a document preview function, a video preview function, an audio preview function and a comprehensive file preview function in the custom instruction;

[0095] The configured custom instructions are encapsulated to obtain preview instructions.

[0096] Specifically, in order to ensure that the preview plug-in constructed by this application can be applied to any file to be previewed and can adapt to different projects or users, when configuring the preview function for custom instructions, it is necessary to configure all types of preview functions at present, including image preview function, document preview function, video preview function, audio preview function and comprehensive file preview function, which can be configured in the form of components. After the configuration is completed, it needs to be packaged to obtain the preview instruction. Specifically, Figure 2 As shown, the encapsulated preview instruction v-preView can replace the complicated components for implementing the preview function in the prior art, and perform two-way binding between elements and click events, configure various types of preview functions, and the operations that can be performed after the preview is implemented include scaling, rotating, moving, closing, etc. This embodiment does not limit the operation method.

[0097] After the creation is complete, use the vsce tool to package the plug-in into an XX.vsix file and upload it to the application market. The preview plug-in can identify the code repository type of different target projects and can be quickly implanted. This process can be understood as the preview plug-in is a transit station that adapts to different code repositories, bringing the preview function into different code repositories to form a unified specification that is applicable to different projects. This can be achieved through the following code:

[0098]

[0099]

[0100] The above embodiment illustrates the process of the method for creating a preview plug-in in the present application. The following describes in detail the process of embedding the preview instruction in the preview plug-in in the main file in the present application.

[0101] Adapting the preview instruction in the preview plug-in;

[0102] The adapted preview instructions are embedded in the master file.

[0103] Specifically, the preview instruction is adapted so that it can be better applied to the target file, so it can be adapted according to the content, type, size and other characteristics of the target file, and then embedded into the main file after adaptation.

[0104] An optional adaptation method is as follows:

[0105] Identify a specific file in the target project;

[0106] Get the file name of the specific file;

[0107] Calling the preview plug-in and determining the project type of the target project based on the file name;

[0108] The preview instructions in the preview plug-in are adapted according to the project type.

[0109] Specifically, the specific file refers to a file that can identify the project type of the target project. For example, for a Vue project, the specific file is the main.js file, and for a React project, the specific file is the index.js file. The file names are main.js and index.js. Therefore, the preview instructions can be adapted to instructions in the form of Vue instructions and React components, respectively, to adapt to the differences brought about by different code frameworks.

[0110] Furthermore, the process of using the preview instruction to create each preview element corresponding to the file to be previewed is as follows:

[0111] Determine each file element under the file to be previewed;

[0112] Bind the preview instruction to each of the file elements to obtain respective bound elements;

[0113] Create a corresponding independent element based on each of the bound elements as respective preview elements.

[0114] Specifically, the preview instruction can be bound under any element, such as <tag v-preView="src">< / tag>. For example:

[0115] <a-icon type="eye" v-preView="item.url">; <div v-preview="file.url"> Preview ;

[0116] <img:src="file.url" v-preView="file.url" / >;

[0117] An independent element, i.e., a preview element, will be created after clicking.

[0118] The above process can be specifically implemented through the following code:

[0119]

[0120]

[0121] In an example, the finally implemented online multi-file preview scenario can be as Figure 3 shown, where three files are previewed simultaneously, belonging to three windows, Window 1, Window 2, and Window 3, and their file types are video, picture, and PPT respectively.

[0122] Corresponding to Figure 1 the method described above, an embodiment of the present invention further provides a file preview device based on a preview plugin for the specific implementation of the method in Figure 1 . The file preview device based on a preview plugin provided by an embodiment of the present invention can be in a computer terminal or various mobile devices. In combination with Figure 4 , the file preview device based on a preview plugin will be introduced, as Figure 4 shown. The device can include:

[0123] A preview plugin download module 10 for downloading a pre-created preview plugin in a target project;

[0124] A target project main file determination module 20 for calling the preview plugin to determine the main file in the target project;

[0125] A preview instruction implantation and global registration module 30, used for implanting the preview instruction in the preview plug-in into the main file and performing global registration;

[0126] A to-be-previewed file determination module 40, configured to respond to a click instruction initiated by a user in the target project to preview a file, and determine a to-be-previewed file corresponding to the click instruction;

[0127] A preview element creation module 50, used to create each preview element corresponding to the file to be previewed using the preview instruction;

[0128] The preview module 60 is used to preview the file to be previewed by using each of the preview elements.

[0129] This scheme creates a preview plug-in in advance. Before performing a file preview, first download the preview plug-in in the target project, call the preview plug-in to determine the main file, and the preview plug-in contains a preview instruction. Therefore, the preview instruction is implanted in the main file and registered globally to ensure that the entire target project can execute the preview instruction, which greatly saves the operation process. It is not necessary to introduce the preview required components or third-party libraries every time a preview is performed as in the prior art. Therefore, when responding to the user's click instruction, the preview element can be created using the preview instruction, and the preview element can be used to preview the preview file. The whole process is simple and efficient, which improves the preview efficiency and is very beneficial to the work of the staff. The preview plug-in created by this application is not only a lightweight plug-in, but also has strong compatibility. While realizing the file preview function, it can also respond quickly and be compatible with different systems / software / projects. It is not limited by the project technology stack, can improve the unity and stability of the target project, will not affect the structure and style of the original code, does not need to modify a large amount of code, can be quickly deployed and used globally, reduces development and maintenance costs, and meets the needs of different systems / software / projects for file management. The preview function is implemented through this preview plug-in, which allows multiple files to be previewed at the same time, and each preview window runs independently. Users or staff can easily drag and drop files for comparison and review, which greatly improves work efficiency and operational convenience and enhances user experience.

[0130] Furthermore, the embodiment of the present application provides a file preview device based on a preview plug-in. Optionally, Figure 5 The hardware structure diagram of the file preview device based on the preview plug-in is shown. Figure 5 The hardware structure of the file preview device based on the preview plug-in may include: at least one processor 01, at least one communication interface 02, at least one memory 03 and at least one communication bus 04.

[0131] In the embodiment of the present application, the number of the processor 01 , the communication interface 02 , the memory 03 , and the communication bus 04 is at least one, and the processor 01 , the communication interface 02 , and the memory 03 communicate with each other through the communication bus 04 .

[0132] The processor 01 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention.

[0133] The memory 03 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), etc., such as at least one disk memory.

[0134] The memory stores a program, and the processor can call the program stored in the memory, and the program is used to execute the following file preview method based on preview plug-in, including:

[0135] Download the pre-created preview plugin in the target project;

[0136] Call the preview plug-in to determine the main file in the target project;

[0137] Embed the preview instruction in the preview plug-in in the main file and register it globally;

[0138] In response to a click instruction initiated by a user to preview a file in the target project, determining a file to be previewed corresponding to the click instruction;

[0139] Using the preview instruction, create each preview element corresponding to the file to be previewed;

[0140] The file to be previewed is previewed using each of the preview elements.

[0141] Optionally, the detailed functions and extended functions of the program may refer to the description of the file preview method based on the preview plug-in in the method embodiment.

[0142] The embodiment of the present application further provides a storage medium, which may store a program suitable for execution by a processor, and when the program is running, controls the device where the storage medium is located to execute the following file preview method based on a preview plug-in, including:

[0143] Download the pre-created preview plugin in the target project;

[0144] Call the preview plug-in to determine the main file in the target project;

[0145] Embed the preview instruction in the preview plug-in in the main file and register it globally;

[0146] In response to a click instruction initiated by a user to preview a file in the target project, determining a file to be previewed corresponding to the click instruction;

[0147] Using the preview instruction, create each preview element corresponding to the file to be previewed;

[0148] The file to be previewed is previewed using each of the preview elements.

[0149] Specifically, the storage medium may be a computer-readable storage medium, and the computer-readable storage medium may be an electronic memory such as a flash memory, an EEPROM (Electrically Erasable Programmable Read-Only Memory), an EPROM, a hard disk or a ROM.

[0150] Optionally, the detailed functions and extended functions of the program may refer to the description of the file preview method based on the preview plug-in in the method embodiment.

[0151] In addition, the functional modules in the various embodiments of the present disclosure can be integrated together to form an independent part, or each module can exist separately, or two or more modules can be integrated to form an independent part. If the function is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for a computer device (which can be a personal computer, a live broadcast device, or a network device, etc.) to perform all or part of the steps of the methods of the various embodiments of the present disclosure.

[0152] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0153] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0154] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A file preview method based on a preview plug-in, characterized in that: include: Download the pre-created preview plugin in the target project; Call the preview plug-in to determine the main file in the target project; Embed the preview instruction in the preview plug-in in the main file and register it globally; In response to a click instruction initiated by a user to preview a file in the target project, determining a file to be previewed corresponding to the click instruction; Using the preview instruction, create each preview element corresponding to the file to be previewed; The file to be previewed is previewed using each of the preview elements.

2. The method according to claim 1, characterized in that The method for creating the preview plug-in includes: Select a plug-in development tool and create a blank directory using the plug-in development tool; Use the command prompt to run the template generation command in the blank directory to generate a plug-in project template; Performing basic configuration on the plug-in project template to obtain a first template; Create a custom instruction, and configure a preview function in the custom instruction to obtain a preview instruction; The preview instruction is implanted into the first template to obtain a preview plug-in.

3. The method according to claim 2, characterized in that The step of performing basic configuration on the plug-in project template to obtain a first template includes: Generate a plug-in project file in the plug-in project template and select JavaScript as the programming language; Naming the plug-in project file and defining a version number to obtain a configuration file; Metadata is configured in the configuration file to obtain a first template.

4. The method according to claim 1, characterized in that: The preview instruction embedded in the preview plug-in in the main file includes: Adapting the preview instruction in the preview plug-in; The adapted preview instructions are embedded in the master file.

5. The method according to claim 4, characterized in that The adapting the preview instruction in the preview plug-in includes: Identify a specific file in the target project; Get the file name of the specific file; Calling the preview plug-in and determining the project type of the target project based on the file name; The preview instructions in the preview plug-in are adapted according to the project type.

6. The method according to claim 2, characterized in that The step of configuring a preview function in the custom instruction to obtain a preview instruction includes: Configure a picture preview function, a document preview function, a video preview function, an audio preview function and a comprehensive file preview function in the custom instruction; The configured custom instructions are encapsulated to obtain preview instructions.

7. The method according to claim 1, characterized in that The step of using the preview instruction to create each preview element corresponding to the file to be previewed includes: Determine each file element under the file to be previewed; Binding the preview instruction with each of the file elements to obtain each binding element; A corresponding independent element is created based on each of the binding elements as each preview element.

8. A file preview device based on a preview plug-in, characterized in that: include: Preview plugin download module, used to download pre-created preview plugins in the target project; A target project master file determination module, used for calling the preview plug-in to determine the master file in the target project; A preview instruction implantation and global registration module, used for implanting the preview instruction in the preview plug-in into the main file and performing global registration; A module for determining files to be previewed, configured to respond to a click instruction initiated by a user to preview a file in the target project and determine a file to be previewed corresponding to the click instruction; A preview element creation module, used to create each preview element corresponding to the file to be previewed using the preview instruction; The preview module is used to preview the file to be previewed by using each of the preview elements.

9. A file preview device based on a preview plug-in, characterized in that: including memory and processor; The memory is used to store programs; The processor is used to execute the program to implement the various steps of the file preview method based on the preview plug-in as described in any one of claims 1 to 7.

10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of file preview based on a preview plug-in as described in any one of claims 1 to 7 are implemented.